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:



64
65
66
# File 'lib/vonage/secrets.rb', line 64

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

#list(params = nil, auto_advance = true) ⇒ ListResponse

Retrieve API Secrets.

Examples:

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

Parameters:

  • params (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (params):

  • :auto_advance (Boolean)

    Set this to ‘false` to not auto-advance through all the pages in the record and collect all the data. The default is `true`.

Returns:

See Also:



49
50
51
# File 'lib/vonage/secrets.rb', line 49

def list(params = nil, auto_advance = true)
  request('/accounts/' +  + '/secrets', params: params, 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:



79
80
81
# File 'lib/vonage/secrets.rb', line 79

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