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