class StatusTask
Public Class Methods
new( webService, thing, *args )
click to toggle source
Constructor method for status task. Initialize status update array.
Calls superclass method
BaseTask::new
# File lib/tasks/statusTask.rb, line 11 def initialize( webService, thing, *args ) super( webService, thing, false ) @web = webService @thing = thing @statusUpdates = statusArgsToArray( *args ) end
Public Instance Methods
do_task_work()
click to toggle source
Do the work for the status task.
# File lib/tasks/statusTask.rb, line 21 def do_task_work @web.add_status( @thing, @statusUpdates ) end
Private Instance Methods
statusArgsToArray( *args )
click to toggle source
Convert status args into an array of hashes.
@param [Array] *args The status args.
# File lib/tasks/statusTask.rb, line 35 def statusArgsToArray( *args ) dataArray = Array.new # # If only one argument, then assume its already an array. # if( args.size == 1 ) dataArray = args[0] # # Otherwise, take the individual arguments, create a hash and insert into an array. # elsif( args.size >= 2 ) data = { :name => args[0], :value => args[1] } if( args.size >= 3 ) data[:unit] = args[2] end dataArray.push( data ) end # # Return the result. # return dataArray end