class NestApi::Thermostat
Public Class Methods
new(device_id, token)
click to toggle source
# File lib/nest_api/thermostat.rb, line 3 def initialize(device_id, token) @id = device_id @token = token end
Public Instance Methods
get(property_id = '')
click to toggle source
Retrieve a property of a thermostat If no property_id is supplied, all properties of the thermostat will be returned
# File lib/nest_api/thermostat.rb, line 10 def get(property_id = '') HTTParty.get("#{NestApi::API_URL}/devices/thermostats/#{@id}/#{property_id}", query: { auth: @token.access_token }) end
update!(property_id:, value:)
click to toggle source
Set a thermostat property to a new value
# File lib/nest_api/thermostat.rb, line 15 def update!(property_id:, value:) HTTParty.put("#{NestApi::API_URL}/devices/thermostats/#{@id}", query: { auth: @token.access_token }, body: { "#{property_id}" => value }.to_json, headers: { 'Content-Type' => 'application/json' }) end