Class: Telnyx::Resources::EmailValidations

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

Overview

Validate email addresses synchronously or in asynchronous batches.

Defined Under Namespace

Classes: Batch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EmailValidations

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

Parameters:



43
44
45
46
# File 'lib/telnyx/resources/email_validations.rb', line 43

def initialize(client:)
  @client = client
  @batch = Telnyx::Resources::EmailValidations::Batch.new(client: client)
end

Instance Attribute Details

#batchTelnyx::Resources::EmailValidations::Batch (readonly)

Validate email addresses synchronously or in asynchronous batches.



9
10
11
# File 'lib/telnyx/resources/email_validations.rb', line 9

def batch
  @batch
end

Instance Method Details

#create(email:, idempotency_key: nil, request_options: {}) ⇒ Telnyx::Models::EmailValidationCreateResponse

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

Validates a single email address and returns deliverability checks.

Parameters:

  • email (String)

    Body param: Email address to validate. Any non-empty string is accepted; invalid

  • idempotency_key (String)

    Header param: Optional opaque, unquoted key for safely retrying the same logical

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/telnyx/resources/email_validations.rb', line 27

def create(params)
  parsed, options = Telnyx::EmailValidationCreateParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: "email_validations",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Telnyx::Models::EmailValidationCreateResponse,
    options: options
  )
end