Class: Telnyx::Resources::MessagingHostedNumbers

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

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.

Parameters:



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

Delete a messaging hosted number

Parameters:

  • id (String)

    Identifies the type of resource.

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

Returns:

See Also:



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.

Parameters:

  • filter_messaging_profile_id (String)

    Filter by messaging profile ID.

  • filter_phone_number (String)

    Filter by exact phone number.

  • filter_phone_number_contains (String)

    Filter by phone number substring.

  • page_number (Integer)
  • page_size (Integer)
  • sort_phone_number (Symbol, Telnyx::Models::MessagingHostedNumberListParams::SortPhoneNumber)

    Sort by phone number.

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

Returns:

See Also:



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.

Parameters:

  • id (String)

    The ID or phone number of the hosted number.

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

Returns:

See Also:



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.

Parameters:

  • id (String)

    The ID or phone number of the hosted number.

  • messaging_product (String)

    Configure the messaging product for this number:

  • messaging_profile_id (String)

    Configure the messaging profile this phone number is assigned to:

  • tags (Array<String>)

    Tags to set on this phone number.

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

Returns:

See Also:



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