Class: Huebot::Bridge
- Inherits:
-
Object
- Object
- Huebot::Bridge
- Defined in:
- lib/huebot/bridge.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
- #groups ⇒ Object
-
#initialize(client) ⇒ Bridge
constructor
A new instance of Bridge.
- #lights ⇒ Object
Constructor Details
#initialize(client) ⇒ Bridge
Returns a new instance of Bridge.
12 13 14 |
# File 'lib/huebot/bridge.rb', line 12 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/huebot/bridge.rb', line 10 def client @client end |
Class Method Details
.connect(config = Huebot::Config.new) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/huebot/bridge.rb', line 3 def self.connect(config = Huebot::Config.new) client = Client.new(config) error = client.connect return nil, error if error return new(client) end |
Instance Method Details
#groups ⇒ Object
20 21 22 |
# File 'lib/huebot/bridge.rb', line 20 def groups client.get!("/groups").map { |(id, attrs)| Group.new(client, id, attrs) } end |
#lights ⇒ Object
16 17 18 |
# File 'lib/huebot/bridge.rb', line 16 def lights client.get!("/lights").map { |(id, attrs)| Light.new(client, id, attrs) } end |