Class: Mailtrap::WebhooksAPI
- Inherits:
-
Object
- Object
- Mailtrap::WebhooksAPI
- Includes:
- BaseAPI
- Defined in:
- lib/mailtrap/webhooks_api.rb
Instance Attribute Summary
Attributes included from BaseAPI
Instance Method Summary collapse
-
#create(options) ⇒ Webhook
Creates a new webhook.
-
#delete(webhook_id) ⇒ Webhook
Deletes a webhook.
-
#get(webhook_id) ⇒ Webhook
Retrieves a specific webhook.
-
#list ⇒ Array<Webhook>
Lists all webhooks for the account.
-
#update(webhook_id, options) ⇒ Webhook
Updates an existing webhook.
Methods included from BaseAPI
Instance Method Details
#create(options) ⇒ Webhook
Creates a new webhook
50 51 52 |
# File 'lib/mailtrap/webhooks_api.rb', line 50 def create() base_create() end |
#delete(webhook_id) ⇒ Webhook
Deletes a webhook
75 76 77 78 |
# File 'lib/mailtrap/webhooks_api.rb', line 75 def delete(webhook_id) response = client.delete("#{base_path}/#{webhook_id}") handle_response(response) if response end |
#get(webhook_id) ⇒ Webhook
Retrieves a specific webhook
27 28 29 |
# File 'lib/mailtrap/webhooks_api.rb', line 27 def get(webhook_id) base_get(webhook_id) end |
#list ⇒ Array<Webhook>
Lists all webhooks for the account
18 19 20 21 |
# File 'lib/mailtrap/webhooks_api.rb', line 18 def list response = client.get(base_path) response[:data].map { |item| build_entity(item, response_class) } end |
#update(webhook_id, options) ⇒ Webhook
Updates an existing webhook
67 68 69 |
# File 'lib/mailtrap/webhooks_api.rb', line 67 def update(webhook_id, ) base_update(webhook_id, , %i[url active payload_format event_types inbound_inbox_id]) end |