Class: Telnyx::Resources::PhoneNumbers::Messaging

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

Overview

Configure your phone numbers

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Messaging

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

Parameters:



109
110
111
# File 'lib/telnyx/resources/phone_numbers/messaging.rb', line 109

def initialize(client:)
  @client = client
end

Instance Method Details

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

Returns phone numbers with their current messaging product and messaging-profile assignments.

Parameters:

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/telnyx/resources/phone_numbers/messaging.rb', line 85

def list(params = {})
  parsed, options = Telnyx::PhoneNumbers::MessagingListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "phone_numbers/messaging",
    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]",
      filter_type: "filter[type]",
      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::PhoneNumbers::MessagingRetrieveResponse

Returns the messaging product and messaging-profile assignment for the specified phone number.

Parameters:

  • id (String)

    Identifies the type of resource.

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

Returns:

See Also:



20
21
22
23
24
25
26
27
# File 'lib/telnyx/resources/phone_numbers/messaging.rb', line 20

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

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

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

Updates the messaging product, messaging profile, or both for the specified phone number.

Parameters:

  • id (String)

    The phone number to update.

  • 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:



50
51
52
53
54
55
56
57
58
59
# File 'lib/telnyx/resources/phone_numbers/messaging.rb', line 50

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