Class: Telnyx::Resources::MessagingHostedNumbers

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/messaging_hosted_numbers.rb,
sig/telnyx/resources/messaging_hosted_numbers.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MessagingHostedNumbers

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



121
122
123
# File 'lib/telnyx/resources/messaging_hosted_numbers.rb', line 121

def initialize(client:)
  @client = client
end

Instance Method Details

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

Removes the specified hosted number from Telnyx messaging management.



109
110
111
112
113
114
115
116
# File 'lib/telnyx/resources/messaging_hosted_numbers.rb', line 109

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

#list(filter_messaging_profile_id: nil, filter_phone_number: nil, filter_phone_number_contains: nil, page_number: nil, page_size: nil, sort_phone_number: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::PhoneNumberWithMessagingSettings>

List all hosted numbers associated with the authenticated user.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/telnyx/resources/messaging_hosted_numbers.rb', line 78

def list(params = {})
  parsed, options = Telnyx::MessagingHostedNumberListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "messaging_hosted_numbers",
    query: query.transform_keys(
      filter_messaging_profile_id: "filter[messaging_profile_id]",
      filter_phone_number: "filter[phone_number]",
      filter_phone_number_contains: "filter[phone_number][contains]",
      page_number: "page[number]",
      page_size: "page[size]",
      sort_phone_number: "sort[phone_number]"
    ),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::PhoneNumberWithMessagingSettings,
    options: options
  )
end

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

Retrieve a specific messaging hosted number by its ID or phone number.



17
18
19
20
21
22
23
24
# File 'lib/telnyx/resources/messaging_hosted_numbers.rb', line 17

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

#update(id, messaging_product: nil, messaging_profile_id: nil, tags: nil, request_options: {}) ⇒ Telnyx::Models::MessagingHostedNumberUpdateResponse

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

Update the messaging settings for a hosted number.



46
47
48
49
50
51
52
53
54
55
# File 'lib/telnyx/resources/messaging_hosted_numbers.rb', line 46

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