Class: Telnyx::Resources::EmailValidations::Batch

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

Overview

Validate email addresses synchronously or in asynchronous batches.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Batch

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

Parameters:



63
64
65
# File 'lib/telnyx/resources/email_validations/batch.rb', line 63

def initialize(client:)
  @client = client
end

Instance Method Details

#create(emails:, webhook_url: nil, idempotency_key: nil, request_options: {}) ⇒ Telnyx::Models::EmailValidations::BatchCreateResponse

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

Creates an asynchronous batch validation job for up to 1,000 email addresses.

Parameters:

  • emails (Array<String>)

    Body param

  • webhook_url (String)

    Body param: URL for batch completion webhook. Empty string is treated as omitted

  • 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:



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

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

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

Retrieves the current status and, once completed, validation results for a batch job.

Parameters:

  • id (String)

    Email validation batch UUID.

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

Returns:

See Also:



51
52
53
54
55
56
57
58
# File 'lib/telnyx/resources/email_validations/batch.rb', line 51

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