Class: HueConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HObject

#to_json

Constructor Details

#initialize(data = {}) ⇒ HueConfig

Returns a new instance of HueConfig.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lights/config.rb', line 12

def initialize(data = {})
  @name = data["name"]
  @zigbee_channel = data["zigbeechannel"]
  @mac = data["mac"]
  @dhcp = data["dhcp"]
  @ip_address = data["ipaddress"]
  @netmask = data["netmask"]
  @gateway = data["gateway"]
  @proxy_address = data["proxyaddress"]
  @proxy_port = data["proxyport"]
  @utc = data["UTC"]
  @local_time = data["localtime"]
  @time_zone = data["timezone"]
  @whitelist = UserList.new(data["whitelist"])
  @sw_version = data["swversion"]
  @api_version = data["apiversion"]
  @sw_update = data["swupdate"]
  @link_button = data["linkbutton"]
  @portal_services = data["portalservices"]
  @portal_connection = data["portalconnection"]
  @portal_state = data["portalstate"]
end

Instance Attribute Details

#api_versionObject (readonly)

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

#dhcpObject (readonly)

Returns the value of attribute dhcp.



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

def dhcp
  @dhcp
end

#gatewayObject (readonly)

Returns the value of attribute gateway.



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

def gateway
  @gateway
end

#ip_addressObject (readonly)

Returns the value of attribute ip_address.



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

def ip_address
  @ip_address
end

Returns the value of attribute link_button.



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

def link_button
  @link_button
end

#local_timeObject (readonly)

Returns the value of attribute local_time.



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

def local_time
  @local_time
end

#macObject (readonly)

Returns the value of attribute mac.



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

def mac
  @mac
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#netmaskObject (readonly)

Returns the value of attribute netmask.



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

def netmask
  @netmask
end

#portal_connectionObject (readonly)

Returns the value of attribute portal_connection.



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

def portal_connection
  @portal_connection
end

#portal_servicesObject (readonly)

Returns the value of attribute portal_services.



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

def portal_services
  @portal_services
end

#portal_stateObject (readonly)

Returns the value of attribute portal_state.



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

def portal_state
  @portal_state
end

#proxy_addressObject (readonly)

Returns the value of attribute proxy_address.



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

def proxy_address
  @proxy_address
end

#proxy_portObject (readonly)

Returns the value of attribute proxy_port.



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

def proxy_port
  @proxy_port
end

#sw_updateObject (readonly)

Returns the value of attribute sw_update.



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

def sw_update
  @sw_update
end

#swversionObject (readonly)

Returns the value of attribute swversion.



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

def swversion
  @swversion
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



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

def time_zone
  @time_zone
end

#utcObject (readonly)

Returns the value of attribute utc.



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

def utc
  @utc
end

#whitelistObject (readonly)

Returns the value of attribute whitelist.



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

def whitelist
  @whitelist
end

#zigbee_channelObject (readonly)

Returns the value of attribute zigbee_channel.



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

def zigbee_channel
  @zigbee_channel
end

Instance Method Details

#dataObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/lights/config.rb', line 35

def data
  data = {}
  data["name"] = @name if @name
  data["zigbeechannel"] = @zigbee_channel if @zigbee_channel
  data["mac"] = @mac if @mac
  data["dhcp"] = @dhcp unless @dhcp.nil?
  data["ipaddress"] = @ip_address if @ip_address
  data["netmask"] = @netmask if @netmask
  data["gateway"] = @gateway if @gateway
  data["proxyaddress"] = @proxy_address if @proxy_address
  data["proxyport"] = @proxy_port if @proxy_port
  data["UTC"] = @utc if @utc
  data["localtime"] = @local_time if @local_time
  data["timezone"] = @time_zone if @time_zone
  data["whitelist"] = @whitelist.data unless @whitelist.data.empty?
  data["swversion"] = @sw_version if @sw_version
  data["apiversion"] = @api_version if @api_version
  data["swupdate"] = @sw_update unless @sw_update.nil?
  data["linkbutton"] = @link_button unless @link_button.nil?
  data["portalservices"] = @portal_services unless @portal_services.nil?
  data["portalconnection"] = @portal_connection if @portal_connection
  data["portalstate"] = @portal_state unless @portal_state.nil?
  data
end