Class: Seam::Clients::NoiseSensorsNoiseThresholds
- Inherits:
-
Object
- Object
- Seam::Clients::NoiseSensorsNoiseThresholds
- Defined in:
- lib/seam/routes/noise_sensors_noise_thresholds.rb
Instance Method Summary collapse
-
#create(device_id:, ends_daily_at:, starts_daily_at:, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil) ⇒ Seam::Resources::NoiseThreshold
Creates a new noise threshold for a noise sensor.
-
#delete(device_id:, noise_threshold_id:) ⇒ nil
Deletes a noise threshold from a noise sensor.
-
#get(noise_threshold_id:) ⇒ Seam::Resources::NoiseThreshold
Returns a specified noise threshold for a noise sensor.
-
#initialize(client:, defaults:) ⇒ NoiseSensorsNoiseThresholds
constructor
A new instance of NoiseSensorsNoiseThresholds.
-
#list(device_id:) ⇒ Seam::Resources::NoiseThreshold
Returns a list of all noise thresholds for a noise sensor.
-
#update(device_id:, noise_threshold_id:, ends_daily_at: nil, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil, starts_daily_at: nil) ⇒ nil
Updates a noise threshold for a noise sensor.
Constructor Details
#initialize(client:, defaults:) ⇒ NoiseSensorsNoiseThresholds
Returns a new instance of NoiseSensorsNoiseThresholds.
6 7 8 9 |
# File 'lib/seam/routes/noise_sensors_noise_thresholds.rb', line 6 def initialize(client:, defaults:) @client = client @defaults = defaults end |
Instance Method Details
#create(device_id:, ends_daily_at:, starts_daily_at:, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil) ⇒ Seam::Resources::NoiseThreshold
Creates a new noise threshold for a noise sensor. Thresholds represent the limits of noise tolerated at a property, which can be customized for each hour of the day. Each device has its own default thresholds, but you can use the Seam API to modify them.
19 20 21 22 23 |
# File 'lib/seam/routes/noise_sensors_noise_thresholds.rb', line 19 def create(device_id:, ends_daily_at:, starts_daily_at:, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil) res = @client.post("/noise_sensors/noise_thresholds/create", {device_id: device_id, ends_daily_at: ends_daily_at, starts_daily_at: starts_daily_at, name: name, noise_threshold_decibels: noise_threshold_decibels, noise_threshold_nrs: noise_threshold_nrs}.compact) Seam::Resources::NoiseThreshold.load_from_response(res.body["noise_threshold"]) end |
#delete(device_id:, noise_threshold_id:) ⇒ nil
Deletes a noise threshold from a noise sensor.
29 30 31 32 33 |
# File 'lib/seam/routes/noise_sensors_noise_thresholds.rb', line 29 def delete(device_id:, noise_threshold_id:) @client.post("/noise_sensors/noise_thresholds/delete", {device_id: device_id, noise_threshold_id: noise_threshold_id}.compact) nil end |
#get(noise_threshold_id:) ⇒ Seam::Resources::NoiseThreshold
Returns a specified noise threshold for a noise sensor.
38 39 40 41 42 |
# File 'lib/seam/routes/noise_sensors_noise_thresholds.rb', line 38 def get(noise_threshold_id:) res = @client.post("/noise_sensors/noise_thresholds/get", {noise_threshold_id: noise_threshold_id}.compact) Seam::Resources::NoiseThreshold.load_from_response(res.body["noise_threshold"]) end |
#list(device_id:) ⇒ Seam::Resources::NoiseThreshold
Returns a list of all noise thresholds for a noise sensor.
47 48 49 50 51 |
# File 'lib/seam/routes/noise_sensors_noise_thresholds.rb', line 47 def list(device_id:) res = @client.post("/noise_sensors/noise_thresholds/list", {device_id: device_id}.compact) Seam::Resources::NoiseThreshold.load_from_response(res.body["noise_thresholds"]) end |
#update(device_id:, noise_threshold_id:, ends_daily_at: nil, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil, starts_daily_at: nil) ⇒ nil
Updates a noise threshold for a noise sensor.
62 63 64 65 66 |
# File 'lib/seam/routes/noise_sensors_noise_thresholds.rb', line 62 def update(device_id:, noise_threshold_id:, ends_daily_at: nil, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil, starts_daily_at: nil) @client.post("/noise_sensors/noise_thresholds/update", {device_id: device_id, noise_threshold_id: noise_threshold_id, ends_daily_at: ends_daily_at, name: name, noise_threshold_decibels: noise_threshold_decibels, noise_threshold_nrs: noise_threshold_nrs, starts_daily_at: starts_daily_at}.compact) nil end |