Sha256: 40e3b64b489a57cb0e7bc13e1ff6147f75c0f2c97c0d250e539945612ada336f

Contents?: true

Size: 664 Bytes

Versions: 5

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

module MyTankInfo
  class AlarmHistoryResource < Resource
    def list(site_id: nil, **params)
      response =
        if site_id.nil?
          get_request("api/alarmhistory", params: params)
        else
          get_request("api/sites/#{site_id}/alarmhistory", params: params)
        end

      Collection.from_response(response, type: Alarm)
    end

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

    def retrieve(alarm_id:)
      Alarm.new get_request("api/alarmhistory/#{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/alarm_history.rb
my_tank_info-1.1.0 lib/my_tank_info/resources/alarm_history.rb
my_tank_info-1.0.2 lib/my_tank_info/resources/alarm_history.rb
my_tank_info-1.0.1 lib/my_tank_info/resources/alarm_history.rb
my_tank_info-1.0.0 lib/my_tank_info/resources/alarm_history.rb