Class: Telnyx::Resources::Whatsapp::BusinessAccounts::PhoneNumbers

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/whatsapp/business_accounts/phone_numbers.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PhoneNumbers

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

Parameters:



70
71
72
# File 'lib/telnyx/resources/whatsapp/business_accounts/phone_numbers.rb', line 70

def initialize(client:)
  @client = client
end

Instance Method Details

#initialize_verification(id, display_name:, phone_number:, language: nil, verification_method: nil, request_options: {}) ⇒ nil

Initialize Whatsapp phone number verification

Parameters:

Returns:

  • (nil)

See Also:



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/telnyx/resources/whatsapp/business_accounts/phone_numbers.rb', line 55

def initialize_verification(id, params)
  parsed, options =
    Telnyx::Whatsapp::BusinessAccounts::PhoneNumberInitializeVerificationParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v2/whatsapp/business_accounts/%1$s/phone_numbers", id],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#list(id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Whatsapp::BusinessAccounts::PhoneNumberListResponse>

List phone numbers for a WABA

Parameters:

  • id (String)

    Whatsapp Business Account ID

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

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/telnyx/resources/whatsapp/business_accounts/phone_numbers.rb', line 23

def list(id, params = {})
  parsed, options = Telnyx::Whatsapp::BusinessAccounts::PhoneNumberListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v2/whatsapp/business_accounts/%1$s/phone_numbers", id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::Whatsapp::BusinessAccounts::PhoneNumberListResponse,
    options: options
  )
end