Class: Pago::V2026_04::Services::Webhooks
- Defined in:
- lib/pago/v2026_04/services/webhooks.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#create_webhook_endpoint(body: {}) ⇒ Models::WebhookEndpoint
Create a webhook endpoint.
-
#delete_webhook_endpoint(id) ⇒ nil
Delete a webhook endpoint.
-
#get_webhook_endpoint(id) ⇒ Models::WebhookEndpoint
Get a webhook endpoint by ID.
-
#list_webhook_deliveries(endpoint_id: nil, start_timestamp: nil, end_timestamp: nil, succeeded: nil, query: nil, http_code_class: nil, event_type: nil, page: 1, limit: 10) ⇒ Models::ListResourceWebhookDelivery
List webhook deliveries.
-
#list_webhook_deliveries_each(endpoint_id: nil, start_timestamp: nil, end_timestamp: nil, succeeded: nil, query: nil, http_code_class: nil, event_type: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list_webhook_deliveries, fetching pages on demand. -
#list_webhook_endpoints(organization_id: nil, page: 1, limit: 10) ⇒ Models::ListResourceWebhookEndpoint
List webhook endpoints.
-
#list_webhook_endpoints_each(organization_id: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list_webhook_endpoints, fetching pages on demand. -
#redeliver_webhook_event(id) ⇒ Object
Schedule the re-delivery of a webhook event.
-
#reset_webhook_endpoint_secret(id) ⇒ Models::WebhookEndpoint
Regenerate a webhook endpoint secret.
-
#update_webhook_endpoint(id, body: {}) ⇒ Models::WebhookEndpoint
Update a webhook endpoint.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#create_webhook_endpoint(body: {}) ⇒ Models::WebhookEndpoint
Create a webhook endpoint.
Scopes: webhooks:write
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 48 def create_webhook_endpoint(body: {}) data = client.request( http_method: "POST", path: "/v1/webhooks/endpoints", path_params: {}, query: {}, body: body, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::WebhookEndpoint.from_json(data) end |
#delete_webhook_endpoint(id) ⇒ nil
Delete a webhook endpoint.
Scopes: webhooks:write
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 91 def delete_webhook_endpoint(id) client.request( http_method: "DELETE", path: "/v1/webhooks/endpoints/{id}", path_params: { "id" => id }, query: {}, response_type: :none, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) end |
#get_webhook_endpoint(id) ⇒ Models::WebhookEndpoint
Get a webhook endpoint by ID.
Scopes: webhooks:read webhooks:write
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 70 def get_webhook_endpoint(id) data = client.request( http_method: "GET", path: "/v1/webhooks/endpoints/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::WebhookEndpoint.from_json(data) end |
#list_webhook_deliveries(endpoint_id: nil, start_timestamp: nil, end_timestamp: nil, succeeded: nil, query: nil, http_code_class: nil, event_type: nil, page: 1, limit: 10) ⇒ Models::ListResourceWebhookDelivery
List webhook deliveries.
Deliveries are all the attempts to deliver a webhook event to an endpoint.
Scopes: webhooks:read webhooks:write
164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 164 def list_webhook_deliveries(endpoint_id: nil, start_timestamp: nil, end_timestamp: nil, succeeded: nil, query: nil, http_code_class: nil, event_type: nil, page: 1, limit: 10) data = client.request( http_method: "GET", path: "/v1/webhooks/deliveries", path_params: {}, query: { "endpoint_id" => endpoint_id, "start_timestamp" => , "end_timestamp" => , "succeeded" => succeeded, "query" => query, "http_code_class" => http_code_class, "event_type" => event_type, "page" => page, "limit" => limit }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceWebhookDelivery.from_json(data) end |
#list_webhook_deliveries_each(endpoint_id: nil, start_timestamp: nil, end_timestamp: nil, succeeded: nil, query: nil, http_code_class: nil, event_type: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list_webhook_deliveries, fetching pages on demand.
180 181 182 183 184 185 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 180 def list_webhook_deliveries_each(endpoint_id: nil, start_timestamp: nil, end_timestamp: nil, succeeded: nil, query: nil, http_code_class: nil, event_type: nil, limit: 10, &block) paginator = ::Pago::Paginator.new do |page_number| list_webhook_deliveries(endpoint_id: endpoint_id, start_timestamp: , end_timestamp: , succeeded: succeeded, query: query, http_code_class: http_code_class, event_type: event_type, page: page_number, limit: limit) end block ? paginator.each(&block) : paginator end |
#list_webhook_endpoints(organization_id: nil, page: 1, limit: 10) ⇒ Models::ListResourceWebhookEndpoint
List webhook endpoints.
Scopes: webhooks:read webhooks:write
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 17 def list_webhook_endpoints(organization_id: nil, page: 1, limit: 10) data = client.request( http_method: "GET", path: "/v1/webhooks/endpoints", path_params: {}, query: { "organization_id" => organization_id, "page" => page, "limit" => limit }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceWebhookEndpoint.from_json(data) end |
#list_webhook_endpoints_each(organization_id: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list_webhook_endpoints, fetching pages on demand.
33 34 35 36 37 38 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 33 def list_webhook_endpoints_each(organization_id: nil, limit: 10, &block) paginator = ::Pago::Paginator.new do |page_number| list_webhook_endpoints(organization_id: organization_id, page: page_number, limit: limit) end block ? paginator.each(&block) : paginator end |
#redeliver_webhook_event(id) ⇒ Object
Schedule the re-delivery of a webhook event.
Scopes: webhooks:write
196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 196 def redeliver_webhook_event(id) data = client.request( http_method: "POST", path: "/v1/webhooks/events/{id}/redeliver", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) data end |
#reset_webhook_endpoint_secret(id) ⇒ Models::WebhookEndpoint
Regenerate a webhook endpoint secret.
Scopes: webhooks:write
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 134 def reset_webhook_endpoint_secret(id) data = client.request( http_method: "PATCH", path: "/v1/webhooks/endpoints/{id}/secret", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::WebhookEndpoint.from_json(data) end |
#update_webhook_endpoint(id, body: {}) ⇒ Models::WebhookEndpoint
Update a webhook endpoint.
Scopes: webhooks:write
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/pago/v2026_04/services/webhooks.rb', line 112 def update_webhook_endpoint(id, body: {}) data = client.request( http_method: "PATCH", path: "/v1/webhooks/endpoints/{id}", path_params: { "id" => id }, query: {}, body: body, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::WebhookEndpoint.from_json(data) end |