Class: Dropcam::Setting
Instance Attribute Summary collapse
-
#camera ⇒ Object
Returns the value of attribute camera.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name, value, camera) ⇒ Setting
constructor
A new instance of Setting.
- #set(value) ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name, value, camera) ⇒ Setting
Returns a new instance of Setting.
5 6 7 8 9 |
# File 'lib/dropcam/setting.rb', line 5 def initialize(name, value, camera) @camera = camera @name = name @current_value = value end |
Instance Attribute Details
#camera ⇒ Object
Returns the value of attribute camera.
4 5 6 |
# File 'lib/dropcam/setting.rb', line 4 def camera @camera end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/dropcam/setting.rb', line 4 def name @name end |
Instance Method Details
#set(value) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/dropcam/setting.rb', line 22 def set(value) response = post(::DROPCAMS_SET_PROPERTY, {"uuid"=>@camera.uuid, "key" => @name, "value" => value}, @camera.) @current_value = value @camera.settings = JSON.parse(response.body)["items"][0] true end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/dropcam/setting.rb', line 18 def to_s "<Dropcam::Setting:#{object_id} @name=#{@name} @value=#{@current_value}>" end |
#value ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dropcam/setting.rb', line 11 def value return false if @current_value == 'false' return true if @current_value == 'true' @current_value end |