Class: Mailtrap::ApiTokensAPI
- Inherits:
-
Object
- Object
- Mailtrap::ApiTokensAPI
- Includes:
- BaseAPI
- Defined in:
- lib/mailtrap/api_tokens_api.rb
Instance Attribute Summary
Attributes included from BaseAPI
Instance Method Summary collapse
-
#create(options) ⇒ ApiToken
Creates a new API token.
-
#delete(token_id) ⇒ Object
Permanently deletes an API token.
-
#get(token_id) ⇒ ApiToken
Retrieves a single API token by ID.
-
#list ⇒ Array<ApiToken>
Lists API tokens visible to the current API token.
-
#reset(token_id) ⇒ ApiToken
Expires the requested token and returns a new one with the same permissions.
Methods included from BaseAPI
Instance Method Details
#create(options) ⇒ ApiToken
Creates a new API token. The full ‘token` value is returned ONLY ONCE — store it securely.
38 39 40 |
# File 'lib/mailtrap/api_tokens_api.rb', line 38 def create() base_create() end |
#delete(token_id) ⇒ Object
Permanently deletes an API token
57 58 59 |
# File 'lib/mailtrap/api_tokens_api.rb', line 57 def delete(token_id) base_delete(token_id) end |
#get(token_id) ⇒ ApiToken
Retrieves a single API token by ID
26 27 28 |
# File 'lib/mailtrap/api_tokens_api.rb', line 26 def get(token_id) base_get(token_id) end |
#list ⇒ Array<ApiToken>
Lists API tokens visible to the current API token
17 18 19 |
# File 'lib/mailtrap/api_tokens_api.rb', line 17 def list base_list end |
#reset(token_id) ⇒ ApiToken
Expires the requested token and returns a new one with the same permissions. The old token stops working after a short grace period. The new ‘token` value is returned ONLY ONCE — store it securely
48 49 50 51 |
# File 'lib/mailtrap/api_tokens_api.rb', line 48 def reset(token_id) response = client.post("#{base_path}/#{token_id}/reset") handle_response(response) end |