Class: Telnyx::Resources::EmailDomains::Webhooks
- Inherits:
-
Object
- Object
- Telnyx::Resources::EmailDomains::Webhooks
- Defined in:
- lib/telnyx/resources/email_domains/webhooks.rb,
sig/telnyx/resources/email_domains/webhooks.rbs
Overview
Per-domain webhook endpoints with event subscriptions
Instance Method Summary collapse
-
#create(domain_id, events:, url:, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Creates a webhook endpoint subscribed to a specific allowlist of event types.
-
#delete(id, domain_id:, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Delete a webhook.
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
-
#list(domain_id, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::EmailDomains::EmailWebhook>
List webhooks for an email domain.
-
#retrieve(id, domain_id:, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Retrieve a webhook.
-
#update(id, domain_id:, events: nil, url: nil, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Update a webhook's URL and/or event subscription.
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.
156 157 158 |
# File 'lib/telnyx/resources/email_domains/webhooks.rb', line 156 def initialize(client:) @client = client end |
Instance Method Details
#create(domain_id, events:, url:, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Creates a webhook endpoint subscribed to a specific allowlist of event types.
Both email.* events (published by email-api) and email_domain.* events
(published by this service) flow through the same webhooks.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/telnyx/resources/email_domains/webhooks.rb', line 25 def create(domain_id, params) parsed, = Telnyx::EmailDomains::WebhookCreateParams.dump_request(params) @client.request( method: :post, path: ["email_domains/%1$s/webhooks", domain_id], body: parsed, model: Telnyx::EmailDomains::EmailWebhookResponse, options: ) end |
#delete(id, domain_id:, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Delete a webhook
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/telnyx/resources/email_domains/webhooks.rb', line 139 def delete(id, params) parsed, = Telnyx::EmailDomains::WebhookDeleteParams.dump_request(params) domain_id = parsed.delete(:domain_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["email_domains/%1$s/webhooks/%2$s", domain_id, id], model: Telnyx::EmailDomains::EmailWebhookResponse, options: ) end |
#list(domain_id, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::EmailDomains::EmailWebhook>
List webhooks for an email domain
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/telnyx/resources/email_domains/webhooks.rb', line 113 def list(domain_id, params = {}) parsed, = Telnyx::EmailDomains::WebhookListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["email_domains/%1$s/webhooks", domain_id], query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::EmailDomains::EmailWebhook, options: ) end |
#retrieve(id, domain_id:, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Retrieve a webhook
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/telnyx/resources/email_domains/webhooks.rb', line 49 def retrieve(id, params) parsed, = Telnyx::EmailDomains::WebhookRetrieveParams.dump_request(params) domain_id = parsed.delete(:domain_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["email_domains/%1$s/webhooks/%2$s", domain_id, id], model: Telnyx::EmailDomains::EmailWebhookResponse, options: ) end |
#update(id, domain_id:, events: nil, url: nil, request_options: {}) ⇒ Telnyx::Models::EmailDomains::EmailWebhookResponse
Update a webhook's URL and/or event subscription. A webhook is bound to its
domain — domain_id is not mutable.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/telnyx/resources/email_domains/webhooks.rb', line 81 def update(id, params) parsed, = Telnyx::EmailDomains::WebhookUpdateParams.dump_request(params) domain_id = parsed.delete(:domain_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["email_domains/%1$s/webhooks/%2$s", domain_id, id], body: parsed, model: Telnyx::EmailDomains::EmailWebhookResponse, options: ) end |