Class: Telnyx::Resources::PortingOrders::AssociatedPhoneNumbers

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/porting_orders/associated_phone_numbers.rb

Overview

Endpoints related to porting orders management.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AssociatedPhoneNumbers

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

Parameters:



104
105
106
# File 'lib/telnyx/resources/porting_orders/associated_phone_numbers.rb', line 104

def initialize(client:)
  @client = client
end

Instance Method Details

#create(porting_order_id, action:, phone_number_range:, request_options: {}) ⇒ Telnyx::Models::PortingOrders::AssociatedPhoneNumberCreateResponse

Creates a new associated phone number for a porting order. This is used for partial porting in GB to specify which phone numbers should be kept or disconnected.

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/telnyx/resources/porting_orders/associated_phone_numbers.rb', line 25

def create(porting_order_id, params)
  parsed, options = Telnyx::PortingOrders::AssociatedPhoneNumberCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["porting_orders/%1$s/associated_phone_numbers", porting_order_id],
    body: parsed,
    model: Telnyx::Models::PortingOrders::AssociatedPhoneNumberCreateResponse,
    options: options
  )
end

#delete(id, porting_order_id:, request_options: {}) ⇒ Telnyx::Models::PortingOrders::AssociatedPhoneNumberDeleteResponse

Deletes an associated phone number from a porting order.

Parameters:

  • id (String)

    Identifies the associated phone number to be deleted

  • porting_order_id (String)

    Identifies the Porting Order associated with the phone number

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

Returns:

See Also:



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

def delete(id, params)
  parsed, options = Telnyx::PortingOrders::AssociatedPhoneNumberDeleteParams.dump_request(params)
  porting_order_id =
    parsed.delete(:porting_order_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["porting_orders/%1$s/associated_phone_numbers/%2$s", porting_order_id, id],
    model: Telnyx::Models::PortingOrders::AssociatedPhoneNumberDeleteResponse,
    options: options
  )
end

#list(porting_order_id, filter: nil, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::PortingOrders::PortingAssociatedPhoneNumber>

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

Returns a list of all associated phone numbers for a porting order. Associated phone numbers are used for partial porting in GB to specify which phone numbers should be kept or disconnected.

Parameters:

Returns:

See Also:



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

def list(porting_order_id, params = {})
  parsed, options = Telnyx::PortingOrders::AssociatedPhoneNumberListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["porting_orders/%1$s/associated_phone_numbers", porting_order_id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::PortingOrders::PortingAssociatedPhoneNumber,
    options: options
  )
end