Class: Telnyx::Resources::Dir::PhoneNumberBatches

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/dir/phone_number_batches.rb

Overview

Phone numbers are submitted to Telnyx for vetting in batches. Batches group all numbers added in a single request under the same Letter of Authorization.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PhoneNumberBatches

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

Parameters:



78
79
80
# File 'lib/telnyx/resources/dir/phone_number_batches.rb', line 78

def initialize(client:)
  @client = client
end

Instance Method Details

#list(dir_id, filter_status: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Dir::PhoneNumberBatchListResponse>

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

List the phone-number batches submitted under a DIR. The enterprise is resolved server-side from the DIR id.

Parameters:

  • dir_id (String)

    The DIR id. Lowercase UUID.

  • filter_status (Symbol, Telnyx::Models::Dir::PhoneNumberBatchListParams::FilterStatus)

    Restrict to batches whose aggregate status equals this value.

  • page_number (Integer)

    1-based page number. Out-of-range values return an empty page with correct meta.

  • page_size (Integer)

    Items per page. Maximum 250; values above are clamped to 250.

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

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/telnyx/resources/dir/phone_number_batches.rb', line 58

def list(dir_id, params = {})
  parsed, options = Telnyx::Dir::PhoneNumberBatchListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["dir/%1$s/phone_number_batches", dir_id],
    query: query.transform_keys(
      filter_status: "filter[status]",
      page_number: "page[number]",
      page_size: "page[size]"
    ),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::Dir::PhoneNumberBatchListResponse,
    options: options
  )
end

#retrieve(batch_id, dir_id:, request_options: {}) ⇒ Telnyx::Models::Dir::PhoneNumberBatchRetrieveResponse

Get a single phone-number batch by id. The enterprise is resolved server-side from the DIR id.

Parameters:

  • batch_id (String)

    The batch id (lowercase UUID).

  • dir_id (String)

    The DIR id. Lowercase UUID.

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

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/telnyx/resources/dir/phone_number_batches.rb', line 23

def retrieve(batch_id, params)
  parsed, options = Telnyx::Dir::PhoneNumberBatchRetrieveParams.dump_request(params)
  dir_id =
    parsed.delete(:dir_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["dir/%1$s/phone_number_batches/%2$s", dir_id, batch_id],
    model: Telnyx::Models::Dir::PhoneNumberBatchRetrieveResponse,
    options: options
  )
end