Class: Hue::RequestBody
- Inherits:
-
Object
- Object
- Hue::RequestBody
- Defined in:
- lib/alexa_hue/hue/request_body.rb
Instance Attribute Summary collapse
-
#alert ⇒ Object
Returns the value of attribute alert.
-
#bri ⇒ Object
Returns the value of attribute bri.
-
#ct ⇒ Object
Returns the value of attribute ct.
-
#effect ⇒ Object
Returns the value of attribute effect.
-
#hue ⇒ Object
Returns the value of attribute hue.
-
#on ⇒ Object
Returns the value of attribute on.
-
#sat ⇒ Object
Returns the value of attribute sat.
-
#scene ⇒ Object
Returns the value of attribute scene.
-
#transitiontime ⇒ Object
Returns the value of attribute transitiontime.
Instance Method Summary collapse
- #clear_scene ⇒ Object
-
#initialize(options = {}) ⇒ RequestBody
constructor
A new instance of RequestBody.
- #reset ⇒ Object
- #to_hash(without_scene: false) ⇒ Object
- #to_json(without_scene: false) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RequestBody
Returns a new instance of RequestBody.
7 8 9 |
# File 'lib/alexa_hue/hue/request_body.rb', line 7 def initialize(={}) .each {|k,v| self.send("#{k}=".to_sym, v)} end |
Instance Attribute Details
#alert ⇒ Object
Returns the value of attribute alert.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def alert @alert end |
#bri ⇒ Object
Returns the value of attribute bri.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def bri @bri end |
#ct ⇒ Object
Returns the value of attribute ct.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def ct @ct end |
#effect ⇒ Object
Returns the value of attribute effect.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def effect @effect end |
#hue ⇒ Object
Returns the value of attribute hue.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def hue @hue end |
#on ⇒ Object
Returns the value of attribute on.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def on @on end |
#sat ⇒ Object
Returns the value of attribute sat.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def sat @sat end |
#scene ⇒ Object
Returns the value of attribute scene.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def scene @scene end |
#transitiontime ⇒ Object
Returns the value of attribute transitiontime.
5 6 7 |
# File 'lib/alexa_hue/hue/request_body.rb', line 5 def transitiontime @transitiontime end |
Instance Method Details
#clear_scene ⇒ Object
15 16 17 |
# File 'lib/alexa_hue/hue/request_body.rb', line 15 def clear_scene @scene = nil end |
#reset ⇒ Object
11 12 13 |
# File 'lib/alexa_hue/hue/request_body.rb', line 11 def reset @hue, @ct, @scene = nil, nil, nil end |
#to_hash(without_scene: false) ⇒ Object
23 24 25 26 27 |
# File 'lib/alexa_hue/hue/request_body.rb', line 23 def to_hash(without_scene:false) hash = {hue: @hue, ct: @ct, bri: @bri, sat: @sat, transitiontime: @transitiontime, on: @on, effect: @effect, alert: alert} hash.merge!(scene: @scene) if without_scene return hash end |
#to_json(without_scene: false) ⇒ Object
19 20 21 |
# File 'lib/alexa_hue/hue/request_body.rb', line 19 def to_json(without_scene:false) return self.to_hash(without_scene: without_scene).to_json end |