Sha256: ee607ecbc9a4dd4d712d2c6cf1337a7abfb121309776e6c352bc4b46970696d2

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module MyTankInfo
  class NotificationContactsResource < Resource
    def list
      response = get_request("api/admin/notificationcontacts")
      Collection.from_response(response, type: NotificationContact)
    end

    def list_sites(contact_id:)
      response = get_request("api/admin/notificationcontacts/#{contact_id}/sites")
      Collection.from_response(response, type: NotificationSite)
    end

    def retrieve(contact_id:)
      NotificationContact.new get_request("api/admin/notificationcontacts/#{contact_id}").body
    end

    def update(contact_id:, **attributes)
      request = put_request("api/admin/notificationcontacts/#{contact_id}", body: attributes)
      NotificationContact.new request.body
    end

    def create(**attributes)
      NotificationContact.new post_request("api/admin/notificationcontacts", body: attributes).body
    end

    def delete(contact_id:)
      NotificationContact.new delete_request("api/admin/notificationcontacts/#{contact_id}").body
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
my_tank_info-1.1.0 lib/my_tank_info/resources/notification_contacts.rb
my_tank_info-1.0.2 lib/my_tank_info/resources/notification_contacts.rb
my_tank_info-1.0.1 lib/my_tank_info/resources/notification_contacts.rb
my_tank_info-1.0.0 lib/my_tank_info/resources/notification_contacts.rb