Module: Dirigera::OnOffBehaviour
Instance Method Summary collapse
Instance Method Details
#off ⇒ Object
17 18 19 20 21 22 |
# File 'lib/dirigera/on_off_behaviour.rb', line 17 def off response = @client.patch("/devices/#{id}", [{ attributes: { isOn: false } }]) raise "Failed to update attribute isOn" unless response.code == 202 @data['attributes']['isOn'] = false end |
#off? ⇒ Boolean
6 7 8 |
# File 'lib/dirigera/on_off_behaviour.rb', line 6 def off? !on? end |
#on ⇒ Object
10 11 12 13 14 15 |
# File 'lib/dirigera/on_off_behaviour.rb', line 10 def on response = @client.patch("/devices/#{id}", [{ attributes: { isOn: true } }]) raise "Failed to update attribute isOn" unless response.code == 202 @data['attributes']['isOn'] = true end |
#on? ⇒ Boolean
2 3 4 |
# File 'lib/dirigera/on_off_behaviour.rb', line 2 def on? @data['attributes']['isOn'] end |