Sha256: 93e577d00bc6875d538040aec5dc35eb44e13eb0f98d9a404cca408efd883886

Contents?: true

Size: 714 Bytes

Versions: 5

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

module MyTankInfo
  class ActiveAlarmsResource < Resource
    def list(site_id: nil, **params)
      response = get_request("api/alarms", params: params)

      if site_id.nil?
        Collection.from_response(response, type: Alarm)
      else
        Collection.from_response(
          response,
          type: Alarm,
          filter_attribute: :site_id,
          filter_value: site_id
        )
      end
    end

    def list_notes(alarm_id:)
      response = get_request("api/alarms/#{alarm_id}/notes")
      Collection.from_response(response, type: AlarmNote)
    end

    def retrieve(alarm_id:)
      Alarm.new get_request("api/alarms/#{alarm_id}").body
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
my_tank_info-1.1.1 lib/my_tank_info/resources/active_alarms.rb
my_tank_info-1.1.0 lib/my_tank_info/resources/active_alarms.rb
my_tank_info-1.0.2 lib/my_tank_info/resources/active_alarms.rb
my_tank_info-1.0.1 lib/my_tank_info/resources/active_alarms.rb
my_tank_info-1.0.0 lib/my_tank_info/resources/active_alarms.rb