Class: Huebot::Bridge

Inherits:
Object
  • Object
show all
Defined in:
lib/huebot/bridge.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Bridge

Returns a new instance of Bridge.



9
10
11
# File 'lib/huebot/bridge.rb', line 9

def initialize(client)
  @client = client
end

Class Method Details

.connect(client = Client.new) ⇒ Object



3
4
5
6
7
# File 'lib/huebot/bridge.rb', line 3

def self.connect(client = Client.new)
  error = client.connect
  return nil, error if error
  return new(client)
end

Instance Method Details

#groupsObject



17
18
19
# File 'lib/huebot/bridge.rb', line 17

def groups
  @client.get!("/groups").map { |(id, attrs)| Group.new(@client, id, attrs) }
end

#lightsObject



13
14
15
# File 'lib/huebot/bridge.rb', line 13

def lights
  @client.get!("/lights").map { |(id, attrs)| Light.new(@client, id, attrs) }
end