Class: Anthropic::Credentials::StaticToken
- Inherits:
-
Object
- Object
- Anthropic::Credentials::StaticToken
- Defined in:
- lib/anthropic/credentials/static_token.rb
Overview
An access token provider that always returns a fixed token with no expiry.
This is the simplest credential provider, suitable for static API keys or tokens that don’t expire. It implements the access token provider protocol by responding to call with an AccessToken.
Instance Method Summary collapse
-
#call(force_refresh: false) ⇒ AccessToken
Returns an AccessToken with the fixed token and no expiry.
-
#initialize(token) ⇒ StaticToken
constructor
A new instance of StaticToken.
Constructor Details
#initialize(token) ⇒ StaticToken
Returns a new instance of StaticToken.
12 13 14 |
# File 'lib/anthropic/credentials/static_token.rb', line 12 def initialize(token) @token = token end |
Instance Method Details
#call(force_refresh: false) ⇒ AccessToken
Returns an AccessToken with the fixed token and no expiry.
20 21 22 |
# File 'lib/anthropic/credentials/static_token.rb', line 20 def call(force_refresh: false) # rubocop:disable Lint/UnusedMethodArgument AccessToken.new(token: @token, expires_at: nil) end |