Class: RubyHue::LightsCollectionState
- Inherits:
-
Object
- Object
- RubyHue::LightsCollectionState
- Includes:
- RubyHue::Light::BasicState
- Defined in:
- lib/ruby_hue/lights_collection_state.rb
Constant Summary
Constants included from RubyHue::Light::BasicState
RubyHue::Light::BasicState::IMMUTABLE_KEYS, RubyHue::Light::BasicState::MAPPING
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Attributes included from RubyHue::Light::BasicState
Instance Method Summary collapse
- #bridge ⇒ Object
-
#initialize(collection) ⇒ LightsCollectionState
constructor
A new instance of LightsCollectionState.
- #save ⇒ Object
Methods included from RubyHue::Light::BasicState
Constructor Details
#initialize(collection) ⇒ LightsCollectionState
Returns a new instance of LightsCollectionState.
7 8 9 |
# File 'lib/ruby_hue/lights_collection_state.rb', line 7 def initialize(collection) @collection = collection end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
5 6 7 |
# File 'lib/ruby_hue/lights_collection_state.rb', line 5 def collection @collection end |
Instance Method Details
#bridge ⇒ Object
11 12 13 |
# File 'lib/ruby_hue/lights_collection_state.rb', line 11 def bridge collection.bridge end |
#save ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/ruby_hue/lights_collection_state.rb', line 15 def save collection.each do |light| url = bridge.resource_url_for("lights/#{light.id}/state") body = JSON.generate updateable_state Client.put_and_parse(url, body: body) end end |