Class: Tomba::Keys
Overview
Keys service for managing API keys.
Provides methods to list, create, reset, and delete API keys.
Instance Method Summary collapse
-
#create_key ⇒ Hash
Create a new API key.
-
#delete_key(id:) ⇒ Hash
Delete an API key.
-
#get_key(id:) ⇒ Hash
Get a specific API key by ID.
-
#get_keys ⇒ Hash
List all API keys.
-
#reset_key(id:) ⇒ Hash
Reset an API key.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Tomba::Service
Instance Method Details
#create_key ⇒ Hash
Create a new API key.
Generates a new API key for the account.
70 71 72 73 74 75 76 77 78 |
# File 'lib/tomba/services/keys.rb', line 70 def create_key path = '/keys' params = {} @client.call('post', path, { 'content-type' => 'application/json' }, params) end |
#delete_key(id:) ⇒ Hash
Delete an API key.
Removes a specific API key by its ID.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/tomba/services/keys.rb', line 51 def delete_key(id:) raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil? path = "/keys/#{id}" params = {} @client.call('delete', path, { 'content-type' => 'application/json' }, params) end |
#get_key(id:) ⇒ Hash
Get a specific API key by ID.
33 34 35 36 37 38 39 40 41 |
# File 'lib/tomba/services/keys.rb', line 33 def get_key(id:) raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil? path = "/keys/#{id}" @client.call('get', path, { 'content-type' => 'application/json' }, {}) end |
#get_keys ⇒ Hash
List all API keys.
Returns all API keys associated with the account.
17 18 19 20 21 22 23 24 25 |
# File 'lib/tomba/services/keys.rb', line 17 def get_keys path = '/keys' params = {} @client.call('get', path, { 'content-type' => 'application/json' }, params) end |
#reset_key(id:) ⇒ Hash
Reset an API key.
Regenerates a specific API key by its ID.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/tomba/services/keys.rb', line 88 def reset_key(id:) raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil? path = "/keys/#{id}" params = {} @client.call('put', path, { 'content-type' => 'application/json' }, params) end |