Class: Telnyx::Resources::ShortCodes
- Inherits:
-
Object
- Object
- Telnyx::Resources::ShortCodes
- Defined in:
- lib/telnyx/resources/short_codes.rb,
sig/telnyx/resources/short_codes.rbs
Overview
Short codes
Instance Method Summary collapse
-
#initialize(client:) ⇒ ShortCodes
constructor
private
A new instance of ShortCodes.
-
#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ShortCode>
Some parameter documentations has been truncated, see Models::ShortCodeListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::ShortCodeRetrieveResponse
Returns the messaging configuration and assignment details for the specified short code.
-
#update(id, messaging_profile_id:, tags: nil, request_options: {}) ⇒ Telnyx::Models::ShortCodeUpdateResponse
Update the settings for a specific short code.
Constructor Details
#initialize(client:) ⇒ ShortCodes
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 ShortCodes.
91 92 93 |
# File 'lib/telnyx/resources/short_codes.rb', line 91 def initialize(client:) @client = client end |
Instance Method Details
#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ShortCode>
Some parameter documentations has been truncated, see Models::ShortCodeListParams for more details.
Returns short codes owned by the authenticated account. Apply the documented filters and pagination parameters to narrow the result set.
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/telnyx/resources/short_codes.rb', line 75 def list(params = {}) parsed, = Telnyx::ShortCodeListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "short_codes", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::ShortCode, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::ShortCodeRetrieveResponse
Returns the messaging configuration and assignment details for the specified short code.
19 20 21 22 23 24 25 26 |
# File 'lib/telnyx/resources/short_codes.rb', line 19 def retrieve(id, params = {}) @client.request( method: :get, path: ["short_codes/%1$s", id], model: Telnyx::Models::ShortCodeRetrieveResponse, options: params[:request_options] ) end |
#update(id, messaging_profile_id:, tags: nil, request_options: {}) ⇒ Telnyx::Models::ShortCodeUpdateResponse
Update the settings for a specific short code. To unbind a short code from a
profile, set the messaging_profile_id to null or an empty string. To add or
update tags, include the tags field as an array of strings.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/telnyx/resources/short_codes.rb', line 45 def update(id, params) parsed, = Telnyx::ShortCodeUpdateParams.dump_request(params) @client.request( method: :patch, path: ["short_codes/%1$s", id], body: parsed, model: Telnyx::Models::ShortCodeUpdateResponse, options: ) end |