Class: MyTankInfo::ActiveAlarmsResource
- Defined in:
- lib/my_tank_info/resources/active_alarms.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #list(site_id: nil, **params) ⇒ Object
- #list_notes(alarm_id:) ⇒ Object
- #retrieve(alarm_id:) ⇒ Object
Methods inherited from Resource
#delete_request, #get_request, #initialize, #patch_request, #post_request, #put_request
Constructor Details
This class inherits a constructor from MyTankInfo::Resource
Instance Method Details
#list(site_id: nil, **params) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# 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:) ⇒ Object
20 21 22 23 |
# 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 |