Class: RubyHue::Bridge
- Inherits:
-
Object
- Object
- RubyHue::Bridge
- Defined in:
- lib/ruby_hue/bridge.rb
Instance Attribute Summary collapse
-
#ip_address ⇒ Object
readonly
Returns the value of attribute ip_address.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ip_address, username = nil) ⇒ Bridge
constructor
A new instance of Bridge.
- #lights ⇒ Object
- #resource_url_for(name) ⇒ Object
Constructor Details
#initialize(ip_address, username = nil) ⇒ Bridge
Returns a new instance of Bridge.
14 15 16 17 |
# File 'lib/ruby_hue/bridge.rb', line 14 def initialize(ip_address, username=nil) @ip_address = ip_address @username = username end |
Instance Attribute Details
#ip_address ⇒ Object (readonly)
Returns the value of attribute ip_address.
3 4 5 |
# File 'lib/ruby_hue/bridge.rb', line 3 def ip_address @ip_address end |
#username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/ruby_hue/bridge.rb', line 4 def username @username end |
Class Method Details
.all ⇒ Object
7 8 9 10 11 |
# File 'lib/ruby_hue/bridge.rb', line 7 def all Client.get_and_parse("http://www.meethue.com/api/nupnp").map do |bridge| self.new(bridge["internalipaddress"]) end end |
Instance Method Details
#lights ⇒ Object
23 24 25 |
# File 'lib/ruby_hue/bridge.rb', line 23 def lights @lights ||= LightsCollection.new(self) end |
#resource_url_for(name) ⇒ Object
19 20 21 |
# File 'lib/ruby_hue/bridge.rb', line 19 def resource_url_for(name) "http://#{ip_address}/api/#{username}/#{name}" end |