Class: MyTankInfo::NotificationRulesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/my_tank_info/resources/notification_rules.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

Constructor Details

This class inherits a constructor from MyTankInfo::Resource

Instance Method Details

#delete(rule_id:) ⇒ Object



24
25
26
# File 'lib/my_tank_info/resources/notification_rules.rb', line 24

def delete(rule_id:)
  delete_request("api/admin/notificationrules/#{rule_id}")
end

#list(code_id:) ⇒ Object



15
16
17
18
# File 'lib/my_tank_info/resources/notification_rules.rb', line 15

def list(code_id:)
  response = get_request("api/admin/notificationrules?codeId=#{code_id}")
  Collection.from_response(response, type: NotificationRule)
end

#list_codesObject



5
6
7
8
# File 'lib/my_tank_info/resources/notification_rules.rb', line 5

def list_codes
  response = get_request("api/admin/notificationrules/codes")
  Collection.from_response(response, type: NotificationCode)
end

#list_contacts(rule_id:) ⇒ Object



10
11
12
13
# File 'lib/my_tank_info/resources/notification_rules.rb', line 10

def list_contacts(rule_id:)
  response = get_request("api/admin/notificationrules/#{rule_id}/contacts")
  Collection.from_response(response, type: NotificationRuleContact)
end

#update(rule_id:, **attributes) ⇒ Object



20
21
22
# File 'lib/my_tank_info/resources/notification_rules.rb', line 20

def update(rule_id:, **attributes)
  put_request("api/admin/notificationrules/#{rule_id}", body: attributes)
end