Class: MyTankInfo::NotificationContactsResource
- Inherits:
-
Resource
- Object
- Resource
- MyTankInfo::NotificationContactsResource
show all
- Defined in:
- lib/my_tank_info/resources/notification_contacts.rb
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#delete_request, #get_request, #initialize, #patch_request, #post_request, #put_request
Instance Method Details
#create(**attributes) ⇒ Object
24
25
26
|
# File 'lib/my_tank_info/resources/notification_contacts.rb', line 24
def create(**attributes)
NotificationContact.new post_request("api/admin/notificationcontacts", body: attributes).body
end
|
#delete(contact_id:) ⇒ Object
28
29
30
|
# File 'lib/my_tank_info/resources/notification_contacts.rb', line 28
def delete(contact_id:)
delete_request("api/admin/notificationcontacts/#{contact_id}")
end
|
#list_sites(contact_id:) ⇒ Object
10
11
12
13
|
# File 'lib/my_tank_info/resources/notification_contacts.rb', line 10
def list_sites(contact_id:)
response = get_request("api/admin/notificationcontacts/#{contact_id}/sites")
Collection.from_response(response, type: NotificationSite)
end
|
#retrieve(contact_id:) ⇒ Object
15
16
17
|
# File 'lib/my_tank_info/resources/notification_contacts.rb', line 15
def retrieve(contact_id:)
NotificationContact.new get_request("api/admin/notificationcontacts/#{contact_id}").body
end
|
#update(contact_id:, **attributes) ⇒ Object
19
20
21
22
|
# File 'lib/my_tank_info/resources/notification_contacts.rb', line 19
def update(contact_id:, **attributes)
request = put_request("api/admin/notificationcontacts/#{contact_id}", body: attributes)
NotificationContact.new request.body
end
|