Class: Telnyx::Resources::ShortCodes
- Inherits:
-
Object
- Object
- Telnyx::Resources::ShortCodes
- Defined in:
- lib/telnyx/resources/short_codes.rb
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.
87 88 89 |
# File 'lib/telnyx/resources/short_codes.rb', line 87 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
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/telnyx/resources/short_codes.rb', line 72 def list(params = {}) parsed, = Telnyx::ShortCodeListParams.dump_request(params) @client.request( method: :get, path: "short_codes", query: parsed.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
17 18 19 20 21 22 23 24 |
# File 'lib/telnyx/resources/short_codes.rb', line 17 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.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/telnyx/resources/short_codes.rb', line 43 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 |