Class: Nexmo::Secrets

Inherits:
Namespace
  • Object
show all
Defined in:
lib/nexmo/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:


28
29
30
# File 'lib/nexmo/secrets.rb', line 28

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:


59
60
61
# File 'lib/nexmo/secrets.rb', line 59

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:


44
45
46
# File 'lib/nexmo/secrets.rb', line 44

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:


74
75
76
# File 'lib/nexmo/secrets.rb', line 74

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