Class: Telnyx::Resources::MobilePhoneNumbers

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/mobile_phone_numbers.rb,
lib/telnyx/resources/mobile_phone_numbers/messaging.rb

Overview

Mobile phone number operations

Defined Under Namespace

Classes: Messaging

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MobilePhoneNumbers

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

Parameters:



103
104
105
106
# File 'lib/telnyx/resources/mobile_phone_numbers.rb', line 103

def initialize(client:)
  @client = client
  @messaging = Telnyx::Resources::MobilePhoneNumbers::Messaging.new(client: client)
end

Instance Attribute Details

#messagingTelnyx::Resources::MobilePhoneNumbers::Messaging (readonly)



8
9
10
# File 'lib/telnyx/resources/mobile_phone_numbers.rb', line 8

def messaging
  @messaging
end

Instance Method Details

#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::MobilePhoneNumber>

List Mobile Phone Numbers

Parameters:

  • page_number (Integer)

    The page number to load

  • page_size (Integer)

    The size of the page

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

Returns:

See Also:



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/telnyx/resources/mobile_phone_numbers.rb', line 87

def list(params = {})
  parsed, options = Telnyx::MobilePhoneNumberListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v2/mobile_phone_numbers",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::MobilePhoneNumber,
    options: options
  )
end

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

Retrieve a Mobile Phone Number

Parameters:

  • id (String)

    The ID of the mobile phone number

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

Returns:

See Also:



21
22
23
24
25
26
27
28
# File 'lib/telnyx/resources/mobile_phone_numbers.rb', line 21

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

#update(id, call_forwarding: nil, call_recording: nil, caller_id_name_enabled: nil, cnam_listing: nil, connection_id: nil, customer_reference: nil, inbound: nil, inbound_call_screening: nil, noise_suppression: nil, outbound: nil, tags: nil, request_options: {}) ⇒ Telnyx::Models::MobilePhoneNumberUpdateResponse

Update a Mobile Phone Number

Parameters:

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
# File 'lib/telnyx/resources/mobile_phone_numbers.rb', line 63

def update(id, params = {})
  parsed, options = Telnyx::MobilePhoneNumberUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v2/mobile_phone_numbers/%1$s", id],
    body: parsed,
    model: Telnyx::Models::MobilePhoneNumberUpdateResponse,
    options: options
  )
end