class Uploadcare::Client::WebhookClient
client for webhook management @see uploadcare.com/api-refs/rest-api/v0.5.0/#tag/Webhook
Public Instance Methods
create(target_url, event: 'file.uploaded', is_active: true)
click to toggle source
Create webhook @see uploadcare.com/docs/api_reference/rest/webhooks/#subscribe
# File lib/uploadcare/client/webhook_client.rb, line 12 def create(target_url, event: 'file.uploaded', is_active: true) body = { 'target_url': target_url, 'event': event, 'is_active': is_active }.to_json post(uri: '/webhooks/', content: body) end
Also aliased as: create_webhook
delete(name)
click to toggle source
Permanently deletes subscription @see uploadcare.com/docs/api_reference/rest/webhooks/#unsubscribe
# File lib/uploadcare/client/webhook_client.rb, line 25 def delete(name) body = { 'name': name }.to_json post(uri: '/webhooks/unsubscribe/', content: body) end
Also aliased as: delete_webhook
list()
click to toggle source
Returns array (not paginated list) of webhooks @see uploadcare.com/docs/api_reference/rest/webhooks/#get-list
# File lib/uploadcare/client/webhook_client.rb, line 19 def list get(uri: '/webhooks/') end
Also aliased as: list_webhooks
update(id, **options)
click to toggle source
Updates webhook @see uploadcare.com/docs/api_reference/rest/webhooks/#subscribe-update
# File lib/uploadcare/client/webhook_client.rb, line 32 def update(id, **options) body = options.to_json post(uri: "/webhooks/#{id}/", content: body) end
Also aliased as: update_webhook