Class: Uploadcare::Rails::Api::Rest::WebhookApi
- Defined in:
- lib/uploadcare/rails/api/rest/webhook_api.rb
Overview
A class that contains Webhook related methods for Uploadcare REST API
Class Method Summary collapse
-
.create_webhook(target_url, event: 'file.uploaded', is_active: true, signing_secret: nil) ⇒ Object
Create a webhook.
-
.delete_webhook(target_url) ⇒ Object
Permanently deletes a webhook.
-
.get_webhooks ⇒ Object
Returns a list (not paginated) of webhooks rubocop:disable Naming/AccessorMethodName.
-
.update_webhook(id, options = {}) ⇒ Object
Updates a webhook.
Class Method Details
.create_webhook(target_url, event: 'file.uploaded', is_active: true, signing_secret: nil) ⇒ Object
Create a webhook
22 23 24 25 |
# File 'lib/uploadcare/rails/api/rest/webhook_api.rb', line 22 def create_webhook(target_url, event: 'file.uploaded', is_active: true, signing_secret: nil) = { target_url: target_url, event: event, is_active: is_active, signing_secret: signing_secret } Uploadcare::Webhook.create(**.compact) end |
.delete_webhook(target_url) ⇒ Object
Permanently deletes a webhook
35 36 37 |
# File 'lib/uploadcare/rails/api/rest/webhook_api.rb', line 35 def delete_webhook(target_url) Uploadcare::Webhook.delete(target_url) end |
.get_webhooks ⇒ Object
Returns a list (not paginated) of webhooks rubocop:disable Naming/AccessorMethodName
15 16 17 |
# File 'lib/uploadcare/rails/api/rest/webhook_api.rb', line 15 def get_webhooks Uploadcare::Webhook.list end |
.update_webhook(id, options = {}) ⇒ Object
Updates a webhook
29 30 31 |
# File 'lib/uploadcare/rails/api/rest/webhook_api.rb', line 29 def update_webhook(id, = {}) Uploadcare::Webhook.update(id, ) end |