Class: Bridge

Inherits:
HObject show all
Defined in:
lib/lights/bridge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HObject

#to_json

Constructor Details

#initialize(data = {}) ⇒ Bridge

Returns a new instance of Bridge.



6
7
8
9
10
11
# File 'lib/lights/bridge.rb', line 6

def initialize(data = {})
  @id = data["id"]
  @ip = data["internalipaddress"]
  @mac = data["macaddress"]
  @name = data["name"]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/lights/bridge.rb', line 5

def id
  @id
end

#ipObject (readonly)

Returns the value of attribute ip.



5
6
7
# File 'lib/lights/bridge.rb', line 5

def ip
  @ip
end

#macObject (readonly)

Returns the value of attribute mac.



5
6
7
# File 'lib/lights/bridge.rb', line 5

def mac
  @mac
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/lights/bridge.rb', line 5

def name
  @name
end

Instance Method Details

#dataObject



13
14
15
16
17
18
19
20
# File 'lib/lights/bridge.rb', line 13

def data
  data = {}
  data["id"] = @id if @id
  data["internalipaddress"] = @ip if @ip
  data["macaddress"] = @mac if @mac
  data["name"] = @name if @name
  data
end