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
Retrieve a 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.
89 90 91 |
# File 'lib/telnyx/resources/short_codes.rb', line 89 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.
List short codes
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/telnyx/resources/short_codes.rb', line 73 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
Retrieve a short code
18 19 20 21 22 23 24 25 |
# File 'lib/telnyx/resources/short_codes.rb', line 18 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.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/telnyx/resources/short_codes.rb', line 44 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 |