class Bulb

Attributes

id[R]
model_id[R]
name[RW]
point_symbol[R]
state[RW]
sw_version[R]
type[R]
unique_id[R]

Public Class Methods

new(id,data = {}) click to toggle source
# File lib/lights/bulb.rb, line 8
def initialize(id,data = {})
  @id = id
  @name = data["name"]
  @type = data["type"]
  @sw_version = data["swversion"]
  @point_symbol = data["pointsymbol"]
  @model_id = data["modelid"]
  @unique_id = data["uniqueid"]
  @state = BulbState.new data["state"]
end

Public Instance Methods

data() click to toggle source
# File lib/lights/bulb.rb, line 19
def data
  data = {}
  data["name"] = @name if @name
  data["type"] = @type if @type
  data["swversion"] = @sw_version if @sw_version
  data["state"] = @state.data unless @state.data.empty?
  data["pointsymbol"] = @point_symbol if @point_symbol
  data["modelid"] = @model_id if @model_id
  data["uniqueid"] = @unique_id if @unique_id
  data
end