Class: Telnyx::Resources::EmailDomains

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/email_domains.rb,
lib/telnyx/resources/email_domains/webhooks.rb,
sig/telnyx/resources/email_domains.rbs,
sig/telnyx/resources/email_domains/webhooks.rbs

Defined Under Namespace

Classes: Webhooks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EmailDomains

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 EmailDomains.

Parameters:



245
246
247
248
# File 'lib/telnyx/resources/email_domains.rb', line 245

def initialize(client:)
  @client = client
  @webhooks = Telnyx::Resources::EmailDomains::Webhooks.new(client: client)
end

Instance Attribute Details

#webhooksTelnyx::Resources::EmailDomains::Webhooks (readonly)

Per-domain webhook endpoints with event subscriptions



8
9
10
# File 'lib/telnyx/resources/email_domains.rb', line 8

def webhooks
  @webhooks
end

Instance Method Details

#create(domain:, dmarc_policy: nil, inbound_enabled: nil, tracking: nil, request_options: {}) ⇒ Telnyx::Models::EmailDomainResponse

Some parameter documentations has been truncated, see Models::EmailDomainCreateParams for more details.

Registers a domain for email sending and optional inbound delivery. The response includes the domain configuration and current verification state.

re

Parameters:

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
# File 'lib/telnyx/resources/email_domains.rb', line 32

def create(params)
  parsed, options = Telnyx::EmailDomainCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "email_domains",
    body: parsed,
    model: Telnyx::EmailDomainResponse,
    options: options
  )
end

#delete(id, force: nil, request_options: {}) ⇒ Telnyx::Models::EmailDomainResponse

Deletes an email domain configuration. Verified domains require force=true, and shared domains are read-only for non-owner accounts.

Parameters:

  • id (String)

    Email domain UUID

  • force (Boolean)

    Required as true when deleting verified domains

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



168
169
170
171
172
173
174
175
176
177
178
# File 'lib/telnyx/resources/email_domains.rb', line 168

def delete(id, params = {})
  parsed, options = Telnyx::EmailDomainDeleteParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :delete,
    path: ["email_domains/%1$s", id],
    query: query,
    model: Telnyx::EmailDomainResponse,
    options: options
  )
end

#list(filter_domain: nil, filter_profile_id: nil, filter_status: nil, filter_type: nil, filter_usable_for_inbound: nil, filter_usable_for_sending: nil, page_after: nil, page_before: nil, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::EmailDomain>

Shared (type: shared) Telnyx-managed domains are included/readable for every account, in addition to the account's own custom domains.

Parameters:

  • filter_domain (String)

    Partial match on domain name (case-insensitive)

  • filter_profile_id (String)

    Filter by profile UUID

  • filter_status (Symbol, Telnyx::Models::EmailDomainStatus)
  • filter_type (Symbol, Telnyx::Models::EmailDomainType)
  • filter_usable_for_inbound (Boolean)
  • filter_usable_for_sending (Boolean)
  • page_after (String)

    Cursor for records after the provided value (cursor pagination)

  • page_before (String)

    Cursor for records before the provided value (cursor pagination)

  • page_number (Integer)

    Page number to return (offset pagination)

  • page_size (Integer)

    Number of records per page

  • sort (Symbol, Telnyx::Models::EmailDomainListParams::Sort)

    Field to sort by. Prefix with - for descending order.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/telnyx/resources/email_domains.rb', line 130

def list(params = {})
  parsed, options = Telnyx::EmailDomainListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "email_domains",
    query: query.transform_keys(
      filter_domain: "filter[domain]",
      filter_profile_id: "filter[profile_id]",
      filter_status: "filter[status]",
      filter_type: "filter[type]",
      filter_usable_for_inbound: "filter[usable_for_inbound]",
      filter_usable_for_sending: "filter[usable_for_sending]",
      page_after: "page[after]",
      page_before: "page[before]",
      page_number: "page[number]",
      page_size: "page[size]"
    ),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::EmailDomain,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::EmailDomainResponse

Shared (type: shared) Telnyx-managed domains are included/readable for every account, in addition to the account's own custom domains.

Parameters:

Returns:

See Also:



55
56
57
58
59
60
61
62
# File 'lib/telnyx/resources/email_domains.rb', line 55

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["email_domains/%1$s", id],
    model: Telnyx::EmailDomainResponse,
    options: params[:request_options]
  )
end

#retrieve_dns_records(domain_id, request_options: {}) ⇒ Telnyx::Models::EmailDomainRetrieveDNSRecordsResponse

Returns the DNS records Telnyx generated for domain ownership and DKIM verification, plus MX records when inbound delivery is enabled.

Parameters:

  • domain_id (String)

    Email domain UUID

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



192
193
194
195
196
197
198
199
# File 'lib/telnyx/resources/email_domains.rb', line 192

def retrieve_dns_records(domain_id, params = {})
  @client.request(
    method: :get,
    path: ["email_domains/%1$s/dns_records", domain_id],
    model: Telnyx::Models::EmailDomainRetrieveDNSRecordsResponse,
    options: params[:request_options]
  )
end

#retrieve_health(id, request_options: {}) ⇒ Telnyx::Models::EmailDomainRetrieveHealthResponse

Returns a summary of domain health including verification status and usability.

Parameters:

Returns:

See Also:



212
213
214
215
216
217
218
219
# File 'lib/telnyx/resources/email_domains.rb', line 212

def retrieve_health(id, params = {})
  @client.request(
    method: :get,
    path: ["email_domains/%1$s/health", id],
    model: Telnyx::Models::EmailDomainRetrieveHealthResponse,
    options: params[:request_options]
  )
end

#update(id, dmarc_policy: nil, inbound_enabled: nil, tracking: nil, request_options: {}) ⇒ Telnyx::Models::EmailDomainResponse

Some parameter documentations has been truncated, see Models::EmailDomainUpdateParams for more details.

Updates mutable settings for an existing email domain, including inbound delivery and tracking configuration. Shared domains are read-only for non-owner accounts.

re

Parameters:

Returns:

See Also:



87
88
89
90
91
92
93
94
95
96
# File 'lib/telnyx/resources/email_domains.rb', line 87

def update(id, params = {})
  parsed, options = Telnyx::EmailDomainUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["email_domains/%1$s", id],
    body: parsed,
    model: Telnyx::EmailDomainResponse,
    options: options
  )
end

#verify(domain_id, request_options: {}) ⇒ Telnyx::Models::EmailDomainResponse

Checks the published DNS records against the records required for the email domain and returns the latest verification results.

Parameters:

  • domain_id (String)

    Email domain UUID

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



233
234
235
236
237
238
239
240
# File 'lib/telnyx/resources/email_domains.rb', line 233

def verify(domain_id, params = {})
  @client.request(
    method: :post,
    path: ["email_domains/%1$s/verify", domain_id],
    model: Telnyx::EmailDomainResponse,
    options: params[:request_options]
  )
end