class Thing

Attributes

code[RW]

Public Properties.

display_name[RW]

Public Properties.

id[RW]

Public Properties.

last_error[RW]

Public Properties.

name[RW]

Public Properties.

product_type[RW]

Public Properties.

Public Class Methods

new( webService, name, productType = '', displayName = '' ) click to toggle source

Constructor method for Thing.

@param [WebService] webService A web service used to communicate with Thingdom. @param [String] name The name of the Thing. @param [String] productType The product type the Thing belongs to. @param [String] displayName A user friendly name for Thing.

# File lib/thing.rb, line 22
def initialize( webService, name, productType = '', displayName = '' )
  @web = webService
  @id = ''
  @name = name
  @product_type = productType
  @display_name = displayName
  @code = ''
  #
  # Perform task to get thing.
  #
  thingTask = ThingTask.new( @web, self )
  response = thingTask.perform()
  #
  # If successful, then update the thing id and code.
  #
  if( response[:response] == 'success' )
    @id = response[:thing_id]
    @code = response[:code]
  end
end

Public Instance Methods

feed( category, message, feedOptions = nil ) click to toggle source

Send a feed with additional feed options.

@param [String] category A feed category that was defined during application registration. @param [String] message The feed message. @param [FeedOption] feedOptions Additional feed options: icon, progress bar, etc.

# File lib/thing.rb, line 50
def feed( category, message, feedOptions = nil )
  feedTask = FeedTask.new( @web, self, category, message, feedOptions )
  feedTask.perform()
end
status( *args ) click to toggle source

Add or update a status item for this Thing.

@param [String] name The status item name. @param [String] value The status item value. @param [String] unit The status item unit.

# File lib/thing.rb, line 62
def status( *args )
  statusTask = StatusTask.new( @web, self, *args )
  statusTask.perform()
end