Class: Sentdm::Resources::Webhooks
- Inherits:
-
Object
- Object
- Sentdm::Resources::Webhooks
- Defined in:
- lib/sentdm/resources/webhooks.rb
Overview
Configure webhook endpoints for real-time event delivery
Instance Method Summary collapse
-
#create(display_name: nil, endpoint_url: nil, event_types: nil, retry_count: nil, test_mode: nil, timeout_seconds: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Some parameter documentations has been truncated, see Models::WebhookCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Deletes a webhook for the authenticated customer.
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
-
#list(page:, page_size:, is_active: nil, search: nil, request_options: {}) ⇒ Sentdm::Models::WebhookListResponse
Retrieves a paginated list of webhooks for the authenticated customer.
-
#list_event_types(request_options: {}) ⇒ Sentdm::Models::WebhookListEventTypesResponse
Retrieves all available webhook event types that can be subscribed to.
-
#list_events(id, page:, page_size:, search: nil, request_options: {}) ⇒ Sentdm::Models::WebhookListEventsResponse
Retrieves a paginated list of delivery events for the specified webhook.
-
#retrieve(id, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Retrieves a single webhook by ID for the authenticated customer.
-
#rotate_secret(id, body:, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::WebhookRotateSecretResponse
Some parameter documentations has been truncated, see Models::WebhookRotateSecretParams for more details.
-
#test_(id, event_type: nil, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::WebhookTestResponse
Some parameter documentations has been truncated, see Models::WebhookTestParams for more details.
-
#toggle_status(id, is_active: nil, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Some parameter documentations has been truncated, see Models::WebhookToggleStatusParams for more details.
-
#update(id, display_name: nil, endpoint_url: nil, event_types: nil, retry_count: nil, test_mode: nil, timeout_seconds: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Some parameter documentations has been truncated, see Models::WebhookUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Webhooks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Webhooks.
293 294 295 |
# File 'lib/sentdm/resources/webhooks.rb', line 293 def initialize(client:) @client = client end |
Instance Method Details
#create(display_name: nil, endpoint_url: nil, event_types: nil, retry_count: nil, test_mode: nil, timeout_seconds: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Some parameter documentations has been truncated, see Models::WebhookCreateParams for more details.
Creates a new webhook endpoint for the authenticated customer.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sentdm/resources/webhooks.rb', line 33 def create(params = {}) parsed, = Sentdm::WebhookCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: "v3/webhooks", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseWebhook, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Deletes a webhook for the authenticated customer.
141 142 143 144 145 146 147 148 |
# File 'lib/sentdm/resources/webhooks.rb', line 141 def delete(id, params = {}) @client.request( method: :delete, path: ["v3/webhooks/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(page:, page_size:, is_active: nil, search: nil, request_options: {}) ⇒ Sentdm::Models::WebhookListResponse
Retrieves a paginated list of webhooks for the authenticated customer.
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/sentdm/resources/webhooks.rb', line 119 def list(params) parsed, = Sentdm::WebhookListParams.dump_request(params) query = Sentdm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v3/webhooks", query: query.transform_keys(page_size: "pageSize", is_active: "isActive"), model: Sentdm::Models::WebhookListResponse, options: ) end |
#list_event_types(request_options: {}) ⇒ Sentdm::Models::WebhookListEventTypesResponse
Retrieves all available webhook event types that can be subscribed to.
159 160 161 162 163 164 165 166 |
# File 'lib/sentdm/resources/webhooks.rb', line 159 def list_event_types(params = {}) @client.request( method: :get, path: "v3/webhooks/event-types", model: Sentdm::Models::WebhookListEventTypesResponse, options: params[:request_options] ) end |
#list_events(id, page:, page_size:, search: nil, request_options: {}) ⇒ Sentdm::Models::WebhookListEventsResponse
Retrieves a paginated list of delivery events for the specified webhook.
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/sentdm/resources/webhooks.rb', line 181 def list_events(id, params) parsed, = Sentdm::WebhookListEventsParams.dump_request(params) query = Sentdm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v3/webhooks/%1$s/events", id], query: query.transform_keys(page_size: "pageSize"), model: Sentdm::Models::WebhookListEventsResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Retrieves a single webhook by ID for the authenticated customer.
56 57 58 59 60 61 62 63 |
# File 'lib/sentdm/resources/webhooks.rb', line 56 def retrieve(id, params = {}) @client.request( method: :get, path: ["v3/webhooks/%1$s", id], model: Sentdm::APIResponseWebhook, options: params[:request_options] ) end |
#rotate_secret(id, body:, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::WebhookRotateSecretResponse
Some parameter documentations has been truncated, see Models::WebhookRotateSecretParams for more details.
Generates a new signing secret for the specified webhook. The old secret is immediately invalidated.
212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/sentdm/resources/webhooks.rb', line 212 def rotate_secret(id, params) parsed, = Sentdm::WebhookRotateSecretParams.dump_request(params) @client.request( method: :post, path: ["v3/webhooks/%1$s/rotate-secret", id], headers: parsed.except(:body).transform_keys(idempotency_key: "idempotency-key"), body: parsed[:body], model: Sentdm::Models::WebhookRotateSecretResponse, options: ) end |
#test_(id, event_type: nil, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::WebhookTestResponse
Some parameter documentations has been truncated, see Models::WebhookTestParams for more details.
Sends a test event to the specified webhook endpoint to verify connectivity.
244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/sentdm/resources/webhooks.rb', line 244 def test_(id, params = {}) parsed, = Sentdm::WebhookTestParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: ["v3/webhooks/%1$s/test", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::Models::WebhookTestResponse, options: ) end |
#toggle_status(id, is_active: nil, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Some parameter documentations has been truncated, see Models::WebhookToggleStatusParams for more details.
Activates or deactivates a webhook for the authenticated customer.
277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/sentdm/resources/webhooks.rb', line 277 def toggle_status(id, params = {}) parsed, = Sentdm::WebhookToggleStatusParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :patch, path: ["v3/webhooks/%1$s/toggle-status", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseWebhook, options: ) end |
#update(id, display_name: nil, endpoint_url: nil, event_types: nil, retry_count: nil, test_mode: nil, timeout_seconds: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseWebhook
Some parameter documentations has been truncated, see Models::WebhookUpdateParams for more details.
Updates an existing webhook for the authenticated customer.
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/sentdm/resources/webhooks.rb', line 93 def update(id, params = {}) parsed, = Sentdm::WebhookUpdateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :put, path: ["v3/webhooks/%1$s", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseWebhook, options: ) end |