Class: Hue::RequestBody

Inherits:
Object
  • Object
show all
Defined in:
lib/alexa_hue/hue/request_body.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options={})
  options.each {|k,v| self.send("#{k}=".to_sym, v)}
end

Instance Attribute Details

#alertObject

Returns the value of attribute alert.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def alert
  @alert
end

#briObject

Returns the value of attribute bri.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def bri
  @bri
end

#ctObject

Returns the value of attribute ct.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def ct
  @ct
end

#effectObject

Returns the value of attribute effect.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def effect
  @effect
end

#hueObject

Returns the value of attribute hue.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def hue
  @hue
end

#onObject

Returns the value of attribute on.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def on
  @on
end

#satObject

Returns the value of attribute sat.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def sat
  @sat
end

#sceneObject

Returns the value of attribute scene.



5
6
7
# File 'lib/alexa_hue/hue/request_body.rb', line 5

def scene
  @scene
end

#transitiontimeObject

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_sceneObject



15
16
17
# File 'lib/alexa_hue/hue/request_body.rb', line 15

def clear_scene
  @scene = nil
end

#resetObject



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