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
45 46 47 |
# File 'lib/mailtrap/webhooks_api.rb', line 45 def create() base_create() end |
#delete(webhook_id) ⇒ Webhook
Deletes a webhook
68 69 70 71 |
# File 'lib/mailtrap/webhooks_api.rb', line 68 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
26 27 28 |
# File 'lib/mailtrap/webhooks_api.rb', line 26 def get(webhook_id) base_get(webhook_id) end |
#list ⇒ Array<Webhook>
Lists all webhooks for the account
17 18 19 20 |
# File 'lib/mailtrap/webhooks_api.rb', line 17 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
60 61 62 |
# File 'lib/mailtrap/webhooks_api.rb', line 60 def update(webhook_id, ) base_update(webhook_id, , %i[url active payload_format event_types]) end |