Packagecom.pluraprocessing.node.affiliate.web
Classpublic class Plura
InheritancePlura Inheritance flash.display.Sprite

Class Plura.

This class allows control of Plura. After instantiating an object, you can use it to start Plura, stop Plura, and change the percent of CPU that Plura is using. You cannot invoke changeCpuUsage(Number) while Plura is running (you must call stopPlura() first).

This class uses JavaScript to communicate with Plura via an iframe. As such, an iframe with id "pluraFrame" and the Plura JavaScript code must be available on the webpage that this method is called from. Also, allowScriptAccess must be set to "always" in the application that utilizes this class.



Public Methods
 MethodDefined by
  
Plura(affiliateId:String, clientId:String, percentCpu:Number)
Instantiates a new Plura object.
Plura
  
changeCpuUsage(percentCpu:Number):void
Change CPU usage on the client computer and start running Plura if it is not already running.
Plura
  
getWorkUnitsCompletedByClient(clientId:String, date:Date):void
Get the number of work units completed by the specified client on the specifed day.
Plura
  
startPlura():void
Start running Plura on the client's computer.
Plura
  
stopPlura():void
Stop running Plura on the client's computer.
Plura
Events
 EventSummaryDefined by
   Dispatched when the number of work units for a client id cannot be successfully retrieved from getWorkUnitsCompletedByClient(String, Date) Plura
   Dispatched when the number of work units for a client id has been successfully retrieved from getWorkUnitsCompletedByClient(String, Date) Plura
Constructor detail
Plura()constructor
public function Plura(affiliateId:String, clientId:String, percentCpu:Number)

Instantiates a new Plura object.

Parameters
affiliateId:String — The affiliate id to be credited with the work units completed. This parameter is optional; null may be passed in. If not null, it must be a String representation of a valid UUID.
 
clientId:String — The id of the current client. This parameter is optional; if null or "" are passed in, a random id will be generated for the client. Must be less than 40 characters in length.
 
percentCpu:Number — The percentage of the client computer's CPU to use for Plura. Must be less than 1 and greater than 0.

Throws
PluraParameterError — If the values passed into this method are invalid.
Method detail
changeCpuUsage()method
public function changeCpuUsage(percentCpu:Number):void

Change CPU usage on the client computer and start running Plura if it is not already running.

Parameters
percentCpu:Number — The percentage of the client computer's CPU to use for Plura. Must be less than 1 and greater than 0.

Throws
PluraStateError — If this method is invoked while Plura is running (call stopPlura() first).
 
PluraParameterError — If the values passed into this method are invalid.
getWorkUnitsCompletedByClient()method 
public function getWorkUnitsCompletedByClient(clientId:String, date:Date):void

Get the number of work units completed by the specified client on the specifed day. A client's work units for a given day will be available 48 hours after the day is over.

If the work units are successfully retrieved for the given client, the PluraEvent.PLURA_SUCCESS event will be dispatched. Otherwise, the PluraEvent.PLURA_ERROR event will be dispatched.

Parameters
clientId:String — The id of the client for which to retrieve the number of work units.
 
date:Date — The day for which to retrieve the number of work units. The time part of this parameter is not used.

Throws
PluraStateError — If this method is invoked while Plura is running (call stopPlura() first).
 
PluraParameterError — If the values passed into this method are invalid.
startPlura()method 
public function startPlura():void

Start running Plura on the client's computer.


Throws
JavascriptMissingError — If the Javascript required to communicate with Plura does not exist on the HTML page.
 
PluraCommunicationError — If there is an error setting the Plura iframe URL.
stopPlura()method 
public function stopPlura():void

Stop running Plura on the client's computer.


Throws
JavascriptMissingError — If the Javascript required to communicate with Plura does not exist on the HTML page.
 
PluraCommunicationError — If there is an error setting the Plura iframe URL.
Event detail
pluraErrorevent 
Event object type: com.pluraprocessing.node.affiliate.web.PluraEvent
PluraEvent.type property = com.pluraprocessing.node.affiliate.web.PluraEvent.PLURA_ERROR

Dispatched when the number of work units for a client id has been successfully retrieved from getWorkUnitsCompletedByClient(String, Date)

The PluraEvent.PLURA_ERROR constant defines the value of the type property of the event object for a pluraError event.

pluraSuccessevent  
Event object type: com.pluraprocessing.node.affiliate.web.PluraEvent
PluraEvent.type property = com.pluraprocessing.node.affiliate.web.PluraEvent.PLURA_SUCCESS

Dispatched when the number of work units for a client id has been successfully retrieved from getWorkUnitsCompletedByClient(String, Date)

The PluraEvent.PLURA_SUCCESS constant defines the value of the type property of the event object for a pluraSuccess event.

The properties of the event object have the following values:

PropertyValue
resultThe number of work units completed by the client specified in the call to getWorkUnitsCompletedByClient.