Class: Seam::Clients::ThermostatsSchedules
- Inherits:
-
Object
- Object
- Seam::Clients::ThermostatsSchedules
- Defined in:
- lib/seam/routes/thermostats_schedules.rb
Instance Method Summary collapse
-
#create(climate_preset_key:, device_id:, ends_at:, starts_at:, is_override_allowed: nil, max_override_period_minutes: nil, name: nil) ⇒ Seam::Resources::ThermostatSchedule
Creates a new thermostat schedule for a specified thermostat.
-
#delete(thermostat_schedule_id:) ⇒ nil
Deletes a thermostat schedule for a specified thermostat.
-
#get(thermostat_schedule_id:) ⇒ Seam::Resources::ThermostatSchedule
Returns a specified thermostat schedule.
-
#initialize(client:, defaults:) ⇒ ThermostatsSchedules
constructor
A new instance of ThermostatsSchedules.
-
#list(device_id:, user_identifier_key: nil) ⇒ Seam::Resources::ThermostatSchedule
Returns a list of all thermostat schedules for a specified thermostat.
-
#update(thermostat_schedule_id:, climate_preset_key: nil, ends_at: nil, is_override_allowed: nil, max_override_period_minutes: nil, name: nil, starts_at: nil) ⇒ nil
Updates a specified thermostat schedule.
Constructor Details
#initialize(client:, defaults:) ⇒ ThermostatsSchedules
Returns a new instance of ThermostatsSchedules.
6 7 8 9 |
# File 'lib/seam/routes/thermostats_schedules.rb', line 6 def initialize(client:, defaults:) @client = client @defaults = defaults end |
Instance Method Details
#create(climate_preset_key:, device_id:, ends_at:, starts_at:, is_override_allowed: nil, max_override_period_minutes: nil, name: nil) ⇒ Seam::Resources::ThermostatSchedule
Creates a new thermostat schedule for a specified thermostat.
20 21 22 23 24 |
# File 'lib/seam/routes/thermostats_schedules.rb', line 20 def create(climate_preset_key:, device_id:, ends_at:, starts_at:, is_override_allowed: nil, max_override_period_minutes: nil, name: nil) res = @client.post("/thermostats/schedules/create", {climate_preset_key: climate_preset_key, device_id: device_id, ends_at: ends_at, starts_at: starts_at, is_override_allowed: is_override_allowed, max_override_period_minutes: max_override_period_minutes, name: name}.compact) Seam::Resources::ThermostatSchedule.load_from_response(res.body["thermostat_schedule"]) end |
#delete(thermostat_schedule_id:) ⇒ nil
Deletes a thermostat schedule for a specified thermostat.
29 30 31 32 33 |
# File 'lib/seam/routes/thermostats_schedules.rb', line 29 def delete(thermostat_schedule_id:) @client.post("/thermostats/schedules/delete", {thermostat_schedule_id: thermostat_schedule_id}.compact) nil end |
#get(thermostat_schedule_id:) ⇒ Seam::Resources::ThermostatSchedule
Returns a specified thermostat schedule.
38 39 40 41 42 |
# File 'lib/seam/routes/thermostats_schedules.rb', line 38 def get(thermostat_schedule_id:) res = @client.post("/thermostats/schedules/get", {thermostat_schedule_id: thermostat_schedule_id}.compact) Seam::Resources::ThermostatSchedule.load_from_response(res.body["thermostat_schedule"]) end |
#list(device_id:, user_identifier_key: nil) ⇒ Seam::Resources::ThermostatSchedule
Returns a list of all thermostat schedules for a specified thermostat.
48 49 50 51 52 |
# File 'lib/seam/routes/thermostats_schedules.rb', line 48 def list(device_id:, user_identifier_key: nil) res = @client.post("/thermostats/schedules/list", {device_id: device_id, user_identifier_key: user_identifier_key}.compact) Seam::Resources::ThermostatSchedule.load_from_response(res.body["thermostat_schedules"]) end |
#update(thermostat_schedule_id:, climate_preset_key: nil, ends_at: nil, is_override_allowed: nil, max_override_period_minutes: nil, name: nil, starts_at: nil) ⇒ nil
Updates a specified thermostat schedule.
63 64 65 66 67 |
# File 'lib/seam/routes/thermostats_schedules.rb', line 63 def update(thermostat_schedule_id:, climate_preset_key: nil, ends_at: nil, is_override_allowed: nil, max_override_period_minutes: nil, name: nil, starts_at: nil) @client.post("/thermostats/schedules/update", {thermostat_schedule_id: thermostat_schedule_id, climate_preset_key: climate_preset_key, ends_at: ends_at, is_override_allowed: is_override_allowed, max_override_period_minutes: max_override_period_minutes, name: name, starts_at: starts_at}.compact) nil end |