Class: Telnyx::Resources::TelephonyCredentials
- Inherits:
-
Object
- Object
- Telnyx::Resources::TelephonyCredentials
- Defined in:
- lib/telnyx/resources/telephony_credentials.rb,
sig/telnyx/resources/telephony_credentials.rbs
Instance Method Summary collapse
-
#create(connection_id:, expires_at: nil, name: nil, tag: nil, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialCreateResponse
Creates a new on-demand telephony credential for the specified connection.
-
#create_token(id, request_options: {}) ⇒ String
Create an Access Token (JWT) for the credential.
-
#delete(id, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialDeleteResponse
Permanently deletes the specified telephony credential, revoking any access it provided.
-
#initialize(client:) ⇒ TelephonyCredentials
constructor
private
A new instance of TelephonyCredentials.
-
#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::TelephonyCredential>
Some parameter documentations has been truncated, see Models::TelephonyCredentialListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialRetrieveResponse
Get the details of an existing On-demand Credential.
-
#update(id, connection_id: nil, expires_at: nil, name: nil, tag: nil, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialUpdateResponse
Updates the specified telephony credential and returns the updated credential.
Constructor Details
#initialize(client:) ⇒ TelephonyCredentials
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 TelephonyCredentials.
162 163 164 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 162 def initialize(client:) @client = client end |
Instance Method Details
#create(connection_id:, expires_at: nil, name: nil, tag: nil, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialCreateResponse
Creates a new on-demand telephony credential for the specified connection. The credential can then be used to generate access tokens for SIP or WebRTC clients.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 24 def create(params) parsed, = Telnyx::TelephonyCredentialCreateParams.dump_request(params) @client.request( method: :post, path: "telephony_credentials", body: parsed, model: Telnyx::Models::TelephonyCredentialCreateResponse, options: ) end |
#create_token(id, request_options: {}) ⇒ String
Create an Access Token (JWT) for the credential.
149 150 151 152 153 154 155 156 157 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 149 def create_token(id, params = {}) @client.request( method: :post, path: ["telephony_credentials/%1$s/token", id], headers: {"accept" => "text/plain"}, model: String, options: params[:request_options] ) end |
#delete(id, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialDeleteResponse
Permanently deletes the specified telephony credential, revoking any access it provided.
129 130 131 132 133 134 135 136 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 129 def delete(id, params = {}) @client.request( method: :delete, path: ["telephony_credentials/%1$s", id], model: Telnyx::Models::TelephonyCredentialDeleteResponse, options: params[:request_options] ) end |
#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::TelephonyCredential>
Some parameter documentations has been truncated, see Models::TelephonyCredentialListParams for more details.
Returns a paginated list of the on-demand telephony credentials on your account, with support for filtering.
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 104 def list(params = {}) parsed, = Telnyx::TelephonyCredentialListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "telephony_credentials", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::TelephonyCredential, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialRetrieveResponse
Get the details of an existing On-demand Credential.
46 47 48 49 50 51 52 53 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 46 def retrieve(id, params = {}) @client.request( method: :get, path: ["telephony_credentials/%1$s", id], model: Telnyx::Models::TelephonyCredentialRetrieveResponse, options: params[:request_options] ) end |
#update(id, connection_id: nil, expires_at: nil, name: nil, tag: nil, request_options: {}) ⇒ Telnyx::Models::TelephonyCredentialUpdateResponse
Updates the specified telephony credential and returns the updated credential.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/telnyx/resources/telephony_credentials.rb', line 74 def update(id, params = {}) parsed, = Telnyx::TelephonyCredentialUpdateParams.dump_request(params) @client.request( method: :patch, path: ["telephony_credentials/%1$s", id], body: parsed, model: Telnyx::Models::TelephonyCredentialUpdateResponse, options: ) end |