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:



239
240
241
242
# File 'lib/telnyx/resources/email_domains.rb', line 239

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.

Create an email domain

re

Parameters:

Returns:

See Also:



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

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

Delete an email domain

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:



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/telnyx/resources/email_domains.rb', line 164

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:



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

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:



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

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

List DNS records for an email domain

Parameters:

  • domain_id (String)

    Email domain UUID

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

Returns:

See Also:



187
188
189
190
191
192
193
194
# File 'lib/telnyx/resources/email_domains.rb', line 187

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:



207
208
209
210
211
212
213
214
# File 'lib/telnyx/resources/email_domains.rb', line 207

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.

Update an email domain

re

Parameters:

Returns:

See Also:



84
85
86
87
88
89
90
91
92
93
# File 'lib/telnyx/resources/email_domains.rb', line 84

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

Verify DNS records for an email domain

Parameters:

  • domain_id (String)

    Email domain UUID

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

Returns:

See Also:



227
228
229
230
231
232
233
234
# File 'lib/telnyx/resources/email_domains.rb', line 227

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