Class: SafetyKit::Resources::AccessTokens
- Inherits:
-
Object
- Object
- SafetyKit::Resources::AccessTokens
- Defined in:
- lib/safety_kit/resources/access_tokens.rb,
sig/safety_kit/resources/access_tokens.rbs
Overview
Exchange a long-lived API key for a short-lived access token suitable for delegated or time-boxed use.
Instance Method Summary collapse
-
#create_access_token(customer_session_id: nil, expires_in: nil, user_id: nil, request_options: {}) ⇒ SafetyKit::Models::AccessTokenCreateAccessTokenResponse
Some parameter documentations has been truncated, see Models::AccessTokenCreateAccessTokenParams for more details.
-
#initialize(client:) ⇒ AccessTokens
constructor
private
A new instance of AccessTokens.
Constructor Details
#initialize(client:) ⇒ AccessTokens
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AccessTokens.
43 44 45 |
# File 'lib/safety_kit/resources/access_tokens.rb', line 43 def initialize(client:) @client = client end |
Instance Method Details
#create_access_token(customer_session_id: nil, expires_in: nil, user_id: nil, request_options: {}) ⇒ SafetyKit::Models::AccessTokenCreateAccessTokenResponse
Some parameter documentations has been truncated, see Models::AccessTokenCreateAccessTokenParams for more details.
Exchange a long-lived API key for a short-lived access token. Authenticate with your long-lived API key as the Bearer token; the response contains a new token that authenticates the same team until it expires. Short-lived access tokens cannot be used to create additional access tokens.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/safety_kit/resources/access_tokens.rb', line 29 def create_access_token(params = {}) parsed, = SafetyKit::AccessTokenCreateAccessTokenParams.dump_request(params) @client.request( method: :post, path: "v1/access_tokens", body: parsed, model: SafetyKit::Models::AccessTokenCreateAccessTokenResponse, options: ) end |