Class: RubyMyq::Device::GarageDoor
- Inherits:
-
Object
- Object
- RubyMyq::Device::GarageDoor
- Defined in:
- lib/ruby_myq/device/garage_door.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(device, headers) ⇒ GarageDoor
constructor
A new instance of GarageDoor.
- #name ⇒ Object
- #open ⇒ Object
- #status ⇒ Object
- #status_since ⇒ Object
Constructor Details
#initialize(device, headers) ⇒ GarageDoor
Returns a new instance of GarageDoor.
8 9 10 11 12 13 |
# File 'lib/ruby_myq/device/garage_door.rb', line 8 def initialize(device, headers) @device = device @headers = headers # API response includes incorrect verion number and http rather than https @device_uri = @device['href'].gsub(/v5/, 'v5.1').gsub(/http/, 'https') end |
Instance Method Details
#close ⇒ Object
23 24 25 |
# File 'lib/ruby_myq/device/garage_door.rb', line 23 def close change_door_state('close') end |
#name ⇒ Object
15 16 17 |
# File 'lib/ruby_myq/device/garage_door.rb', line 15 def name @device['name'] end |
#open ⇒ Object
19 20 21 |
# File 'lib/ruby_myq/device/garage_door.rb', line 19 def open change_door_state('open') end |
#status ⇒ Object
27 28 29 30 |
# File 'lib/ruby_myq/device/garage_door.rb', line 27 def status state = request_door_state state['door_state'] end |
#status_since ⇒ Object
32 33 34 35 |
# File 'lib/ruby_myq/device/garage_door.rb', line 32 def status_since state = request_door_state state['last_update'] end |