Class: Inttegro::Resources::Keys
- Inherits:
-
Object
- Object
- Inttegro::Resources::Keys
- Defined in:
- lib/inttegro/resources/keys.rb
Overview
Client for secret-key creation, public metadata, revocation, and authentication activity.
Access this resource through Client#keys. Lookup and listing methods never return bearer token material; the token is available only in the result of #generate.
Instance Method Summary collapse
-
#destroy(secret_key_id: nil, key_id: nil, id: nil) ⇒ Inttegro::SecretKey
Revoke one secret key using a supported identifier name.
-
#generate(payload = {}) ⇒ Inttegro::SecretKey::Generated
Generate a new active secret key.
-
#initialize(http) ⇒ Keys
constructor
A new instance of Keys.
-
#lookup(secret_key_id: nil, key_id: nil, id: nil) ⇒ Inttegro::SecretKey
Retrieve one secret key's public metadata using a supported identifier name.
-
#page(payload = {}) ⇒ Inttegro::SecretKey::Page
Retrieve public metadata for the application's secret keys.
-
#update(payload) ⇒ Inttegro::SecretKey
Update mutable secret-key metadata.
-
#usage(secret_key_id: nil, key_id: nil, id: nil, **options) ⇒ Inttegro::SecretKey::Usage
Retrieve recent authentication outcomes for one secret key.
Constructor Details
#initialize(http) ⇒ Keys
Returns a new instance of Keys.
12 13 14 |
# File 'lib/inttegro/resources/keys.rb', line 12 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#destroy(secret_key_id: nil, key_id: nil, id: nil) ⇒ Inttegro::SecretKey
Revoke one secret key using a supported identifier name.
62 63 64 65 66 67 68 |
# File 'lib/inttegro/resources/keys.rb', line 62 def destroy(secret_key_id: nil, key_id: nil, id: nil) @http.post_resource( "/keys/destroy", Inttegro::SecretKey, :key, identifier_payload(secret_key_id, key_id, id) ) end |
#generate(payload = {}) ⇒ Inttegro::SecretKey::Generated
Generate a new active secret key.
20 21 22 |
# File 'lib/inttegro/resources/keys.rb', line 20 def generate(payload = {}) @http.post_resource("/keys/generate", Inttegro::SecretKey::Generated, :key, payload || {}) end |
#lookup(secret_key_id: nil, key_id: nil, id: nil) ⇒ Inttegro::SecretKey
Retrieve one secret key's public metadata using a supported identifier name.
The first non-+nil+ value in secret_key_id, key_id, and id order is sent.
40 41 42 43 44 45 46 |
# File 'lib/inttegro/resources/keys.rb', line 40 def lookup(secret_key_id: nil, key_id: nil, id: nil) @http.post_resource( "/keys/lookup", Inttegro::SecretKey, :key, identifier_payload(secret_key_id, key_id, id) ) end |
#page(payload = {}) ⇒ Inttegro::SecretKey::Page
Retrieve public metadata for the application's secret keys.
28 29 30 |
# File 'lib/inttegro/resources/keys.rb', line 28 def page(payload = {}) @http.post_resource("/keys/page", Inttegro::SecretKey::Page, :page, payload || {}) end |
#update(payload) ⇒ Inttegro::SecretKey
Update mutable secret-key metadata.
52 53 54 |
# File 'lib/inttegro/resources/keys.rb', line 52 def update(payload) @http.post_resource("/keys/update", Inttegro::SecretKey, :key, payload) end |
#usage(secret_key_id: nil, key_id: nil, id: nil, **options) ⇒ Inttegro::SecretKey::Usage
Retrieve recent authentication outcomes for one secret key.
77 78 79 80 81 |
# File 'lib/inttegro/resources/keys.rb', line 77 def usage(secret_key_id: nil, key_id: nil, id: nil, **) @http.post_model("/keys/usage", Inttegro::SecretKey::Usage, identifier_payload(secret_key_id, key_id, id).merge() ) end |