Class: Uploadcare::Rails::Api::Rest::WebhookApi

Inherits:
Base
  • Object
show all
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

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)
  options = { target_url: target_url, event: event, is_active: is_active, signing_secret: signing_secret }
  Uploadcare::Webhook.create(**options.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_webhooksObject

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, options = {})
  Uploadcare::Webhook.update(id, options)
end