Class: Nombaone::Resources::WebhookEndpoints
- Inherits:
-
BaseResource
- Object
- BaseResource
- Nombaone::Resources::WebhookEndpoints
- Defined in:
- lib/nombaone/resources/webhook_endpoints.rb,
sig/nombaone/resources.rbs
Overview
Webhook endpoints — register and manage the URLs that receive signed events. To verify incoming deliveries in your handler, use Nombaone.webhooks / Webhooks#construct_event — the crypto helper, not this REST resource.
Instance Method Summary collapse
-
#create(url:, enabled_events: OMIT, request_options: {}) ⇒ NombaObject
Register an endpoint.
-
#delete(id, request_options: {}) ⇒ NombaObject
Delete an endpoint.
-
#deliveries ⇒ WebhookEndpointDeliveries
Deliveries under an endpoint.
-
#list(request_options: {}) ⇒ Page<NombaObject>
List your endpoints.
-
#retrieve(id, request_options: {}) ⇒ NombaObject
Retrieve an endpoint by id.
-
#rotate_secret(id, request_options: {}) ⇒ NombaObject
Rotate the signing secret.
-
#update(id, url: OMIT, enabled_events: OMIT, disabled: OMIT, request_options: {}) ⇒ NombaObject
Update url, event subscription, or enabled state.
Methods inherited from BaseResource
#encode, #initialize, #request, #request_page
Constructor Details
This class inherits a constructor from Nombaone::Resources::BaseResource
Instance Method Details
#create(url:, enabled_events: OMIT, request_options: {}) ⇒ NombaObject
Register an endpoint. The response includes the full signing_secret
exactly once — store it in your secret manager immediately.
82 83 84 85 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 82 def create(url:, enabled_events: OMIT, request_options: {}) request(:post, "/webhooks", body: { url: url, enabled_events: enabled_events }, options: ) end |
#delete(id, request_options: {}) ⇒ NombaObject
Delete an endpoint. Pending deliveries to it are retired.
124 125 126 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 124 def delete(id, request_options: {}) request(:delete, "/webhooks/#{encode(id)}", options: ) end |
#deliveries ⇒ WebhookEndpointDeliveries
Deliveries under an endpoint.
63 64 65 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 63 def deliveries @deliveries ||= WebhookEndpointDeliveries.new(@client) end |
#list(request_options: {}) ⇒ Page<NombaObject>
List your endpoints.
115 116 117 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 115 def list(request_options: {}) request_page("/webhooks", options: ) end |
#retrieve(id, request_options: {}) ⇒ NombaObject
Retrieve an endpoint by id.
93 94 95 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 93 def retrieve(id, request_options: {}) request(:get, "/webhooks/#{encode(id)}", options: ) end |
#rotate_secret(id, request_options: {}) ⇒ NombaObject
Rotate the signing secret. The new secret is returned exactly once; the old one is briefly honored so you can roll without dropping in-flight deliveries.
135 136 137 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 135 def rotate_secret(id, request_options: {}) request(:post, "/webhooks/#{encode(id)}/rotate-secret", body: {}, options: ) end |
#update(id, url: OMIT, enabled_events: OMIT, disabled: OMIT, request_options: {}) ⇒ NombaObject
Update url, event subscription, or enabled state.
105 106 107 108 109 |
# File 'lib/nombaone/resources/webhook_endpoints.rb', line 105 def update(id, url: OMIT, enabled_events: OMIT, disabled: OMIT, request_options: {}) request(:patch, "/webhooks/#{encode(id)}", body: { url: url, enabled_events: enabled_events, disabled: disabled }, options: ) end |