Class: Seam::Clients::NoiseSensorsNoiseThresholds

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/clients/noise_sensors_noise_thresholds.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ NoiseSensorsNoiseThresholds

Returns a new instance of NoiseSensorsNoiseThresholds.



6
7
8
9
# File 'lib/seam/routes/clients/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, sync: nil) ⇒ Object



11
12
13
14
15
# File 'lib/seam/routes/clients/noise_sensors_noise_thresholds.rb', line 11

def create(device_id:, ends_daily_at:, starts_daily_at:, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil, sync: 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, sync: sync}.compact)

  Seam::Resources::NoiseThreshold.load_from_response(res.body["noise_threshold"])
end

#delete(device_id:, noise_threshold_id:, sync: nil) ⇒ Object



17
18
19
20
21
# File 'lib/seam/routes/clients/noise_sensors_noise_thresholds.rb', line 17

def delete(device_id:, noise_threshold_id:, sync: nil)
  @client.post("/noise_sensors/noise_thresholds/delete", {device_id: device_id, noise_threshold_id: noise_threshold_id, sync: sync}.compact)

  nil
end

#get(noise_threshold_id:) ⇒ Object



23
24
25
26
27
# File 'lib/seam/routes/clients/noise_sensors_noise_thresholds.rb', line 23

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:, is_programmed: nil) ⇒ Object



29
30
31
32
33
# File 'lib/seam/routes/clients/noise_sensors_noise_thresholds.rb', line 29

def list(device_id:, is_programmed: nil)
  res = @client.post("/noise_sensors/noise_thresholds/list", {device_id: device_id, is_programmed: is_programmed}.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, sync: nil) ⇒ Object



35
36
37
38
39
# File 'lib/seam/routes/clients/noise_sensors_noise_thresholds.rb', line 35

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, sync: 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, sync: sync}.compact)

  nil
end