Class: Rerout::Resources::Webhooks
- Inherits:
-
Object
- Object
- Rerout::Resources::Webhooks
- Defined in:
- lib/rerout/webhooks_resource.rb
Overview
Webhook endpoint management namespace — create, list, delete endpoints for the project that owns the API key.
This is distinct from Webhooks, which verifies inbound delivery signatures. Reach it via ‘client.webhooks`.
Instance Method Summary collapse
-
#create(input) ⇒ Rerout::Models::CreatedWebhook
Create a webhook endpoint.
-
#delete(endpoint_id) ⇒ Hash
Soft-delete an endpoint and abandon its pending deliveries.
-
#initialize(client) ⇒ Webhooks
constructor
A new instance of Webhooks.
-
#list ⇒ Rerout::Models::ListWebhooksResult
List webhook endpoints and the event types the server can deliver.
Constructor Details
#initialize(client) ⇒ Webhooks
Returns a new instance of Webhooks.
14 15 16 |
# File 'lib/rerout/webhooks_resource.rb', line 14 def initialize(client) @client = client end |
Instance Method Details
#create(input) ⇒ Rerout::Models::CreatedWebhook
Create a webhook endpoint. The returned ‘signing_secret` (`whsec_…`) is shown once — persist it to verify future deliveries.
23 24 25 26 27 |
# File 'lib/rerout/webhooks_resource.rb', line 23 def create(input) body = coerce_input(input) response = @client.request(method: :post, path: '/v1/projects/me/webhooks', body: body) Models::CreatedWebhook.from_hash(response) end |
#delete(endpoint_id) ⇒ Hash
Soft-delete an endpoint and abandon its pending deliveries. Idempotent.
41 42 43 |
# File 'lib/rerout/webhooks_resource.rb', line 41 def delete(endpoint_id) @client.request(method: :delete, path: webhook_path(endpoint_id)) end |
#list ⇒ Rerout::Models::ListWebhooksResult
List webhook endpoints and the event types the server can deliver.
32 33 34 35 |
# File 'lib/rerout/webhooks_resource.rb', line 32 def list response = @client.request(method: :get, path: '/v1/projects/me/webhooks') Models::ListWebhooksResult.from_hash(response) end |