Class: Vonage::Secrets

Inherits:
Namespace
  • Object
show all
Defined in:
lib/vonage/secrets.rb

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Response

Create API Secret.

Examples:

response = client.secrets.create(secret: 'T0ps3cr3t')

Parameters:

  • params (Hash)

Options Hash (params):

  • :secret (required, String)

    The new secret must follow these rules:

    • minimum 8 characters
    • maximum 25 characters
    • minimum 1 lower case character
    • minimum 1 upper case character
    • minimum 1 digit

Returns:

See Also:


29
30
31
# File 'lib/vonage/secrets.rb', line 29

def create(params)
  request('/accounts/' +  + '/secrets', params: params, type: Post)
end

#get(secret_id) ⇒ Response

Retrieve one API Secret.

Examples:

response = client.secrets.get(secret_id)

Parameters:

  • secret_id (String)

Returns:

See Also:


60
61
62
# File 'lib/vonage/secrets.rb', line 60

def get(secret_id)
  request('/accounts/' +  + '/secrets/' + secret_id)
end

#listListResponse

Retrieve API Secrets.

Examples:

response = client.secrets.list
response.each do |item|
  puts "#{item.created_at} #{item.id}"
end

Returns:

See Also:


45
46
47
# File 'lib/vonage/secrets.rb', line 45

def list
  request('/accounts/' +  + '/secrets', response_class: ListResponse)
end

#revoke(secret_id) ⇒ Response

Revoke an API Secret.

Examples:

response = client.secrets.revoke(secret_id)

Parameters:

  • secret_id (String)

Returns:

See Also:


75
76
77
# File 'lib/vonage/secrets.rb', line 75

def revoke(secret_id)
  request('/accounts/' +  + '/secrets/' + secret_id, type: Delete)
end