Class: Telnyx::Resources::MessagingHostedNumberOrders

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/messaging_hosted_number_orders.rb,
lib/telnyx/resources/messaging_hosted_number_orders/actions.rb

Overview

Manage your messaging hosted numbers

Defined Under Namespace

Classes: Actions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MessagingHostedNumberOrders

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

Parameters:



179
180
181
182
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 179

def initialize(client:)
  @client = client
  @actions = Telnyx::Resources::MessagingHostedNumberOrders::Actions.new(client: client)
end

Instance Attribute Details

#actionsTelnyx::Resources::MessagingHostedNumberOrders::Actions (readonly)

Manage your messaging hosted numbers



9
10
11
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 9

def actions
  @actions
end

Instance Method Details

#check_eligibility(phone_numbers:, request_options: {}) ⇒ Telnyx::Models::MessagingHostedNumberOrderCheckEligibilityResponse

Check hosted messaging eligibility

Parameters:

  • phone_numbers (Array<String>)

    List of phone numbers to check eligibility

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

Returns:

See Also:



113
114
115
116
117
118
119
120
121
122
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 113

def check_eligibility(params)
  parsed, options = Telnyx::MessagingHostedNumberOrderCheckEligibilityParams.dump_request(params)
  @client.request(
    method: :post,
    path: "messaging_hosted_number_orders/eligibility_numbers_check",
    body: parsed,
    model: Telnyx::Models::MessagingHostedNumberOrderCheckEligibilityResponse,
    options: options
  )
end

#create(messaging_profile_id: nil, phone_numbers: nil, request_options: {}) ⇒ Telnyx::Models::MessagingHostedNumberOrderCreateResponse

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

Create a messaging hosted number order

Parameters:

  • messaging_profile_id (String)

    Automatically associate the number with this messaging profile ID when the order

  • phone_numbers (Array<String>)

    Phone numbers to be used for hosted messaging.

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

Returns:

See Also:



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

def create(params = {})
  parsed, options = Telnyx::MessagingHostedNumberOrderCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "messaging_hosted_number_orders",
    body: parsed,
    model: Telnyx::Models::MessagingHostedNumberOrderCreateResponse,
    options: options
  )
end

#create_verification_codes(id, phone_numbers:, verification_method:, request_options: {}) ⇒ Telnyx::Models::MessagingHostedNumberOrderCreateVerificationCodesResponse

Create verification codes to validate numbers of the hosted order. The verification codes will be sent to the numbers of the hosted order.

Parameters:

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 140

def create_verification_codes(id, params)
  parsed, options = Telnyx::MessagingHostedNumberOrderCreateVerificationCodesParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["messaging_hosted_number_orders/%1$s/verification_codes", id],
    body: parsed,
    model: Telnyx::Models::MessagingHostedNumberOrderCreateVerificationCodesResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::MessagingHostedNumberOrderDeleteResponse

Delete a messaging hosted number order and all associated phone numbers.

Parameters:

  • id (String)

    Identifies the messaging hosted number order to delete.

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

Returns:

See Also:



93
94
95
96
97
98
99
100
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 93

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["messaging_hosted_number_orders/%1$s", id],
    model: Telnyx::Models::MessagingHostedNumberOrderDeleteResponse,
    options: params[:request_options]
  )
end

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

List messaging hosted number orders

Parameters:

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

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 69

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

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

Retrieve a messaging hosted number order

Parameters:

  • id (String)

    Identifies the type of resource.

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

Returns:

See Also:



49
50
51
52
53
54
55
56
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 49

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

#validate_codes(id, verification_codes:, request_options: {}) ⇒ Telnyx::Models::MessagingHostedNumberOrderValidateCodesResponse

Validate the verification codes sent to the numbers of the hosted order. The verification codes must be created in the verification codes endpoint.

Parameters:

Returns:

See Also:



165
166
167
168
169
170
171
172
173
174
# File 'lib/telnyx/resources/messaging_hosted_number_orders.rb', line 165

def validate_codes(id, params)
  parsed, options = Telnyx::MessagingHostedNumberOrderValidateCodesParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["messaging_hosted_number_orders/%1$s/validation_codes", id],
    body: parsed,
    model: Telnyx::Models::MessagingHostedNumberOrderValidateCodesResponse,
    options: options
  )
end