class MyTankInfo::ActiveAlarmsResource

Public Instance Methods

list(site_id: nil, **params) click to toggle source
# File lib/my_tank_info/resources/active_alarms.rb, line 5
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
list_notes(alarm_id:) click to toggle source
# File lib/my_tank_info/resources/active_alarms.rb, line 20
def list_notes(alarm_id:)
  response = get_request("api/alarms/#{alarm_id}/notes")
  Collection.from_response(response, type: AlarmNote)
end
retrieve(alarm_id:) click to toggle source
# File lib/my_tank_info/resources/active_alarms.rb, line 25
def retrieve(alarm_id:)
  Alarm.new get_request("api/alarms/#{alarm_id}").body
end