Class: Telnyx::Resources::IntegrationSecrets

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/integration_secrets.rb

Overview

Store and retrieve integration secrets

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ IntegrationSecrets

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

Parameters:



91
92
93
# File 'lib/telnyx/resources/integration_secrets.rb', line 91

def initialize(client:)
  @client = client
end

Instance Method Details

#create(identifier:, type:, token: nil, password: nil, username: nil, request_options: {}) ⇒ Telnyx::Models::IntegrationSecretCreateResponse

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

Create a new secret with an associated identifier that can be used to securely integrate with other services.

Parameters:

  • identifier (String)

    The unique identifier of the secret.

  • type (Symbol, Telnyx::Models::IntegrationSecretCreateParams::Type)

    The type of secret.

  • token (String)

    The token for the secret. Required for bearer type secrets, ignored otherwise.

  • password (String)

    The password for the secret. Required for basic type secrets, ignored otherwise.

  • username (String)

    The username for the secret. Required for basic type secrets, ignored otherwise.

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/telnyx/resources/integration_secrets.rb', line 30

def create(params)
  parsed, options = Telnyx::IntegrationSecretCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "integration_secrets",
    body: parsed,
    model: Telnyx::Models::IntegrationSecretCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

Delete an integration secret given its ID.

Parameters:

Returns:

  • (nil)

See Also:



79
80
81
82
83
84
85
86
# File 'lib/telnyx/resources/integration_secrets.rb', line 79

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["integration_secrets/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::IntegrationSecret>

Retrieve a list of all integration secrets configured by the user.

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/telnyx/resources/integration_secrets.rb', line 56

def list(params = {})
  parsed, options = Telnyx::IntegrationSecretListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "integration_secrets",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::IntegrationSecret,
    options: options
  )
end