Class: Fizzy::StaticTokenProvider

Inherits:
Object
  • Object
show all
Includes:
TokenProvider
Defined in:
lib/fizzy/static_token_provider.rb

Overview

A simple token provider that returns a static access token. Useful for testing or when you manage token refresh externally.

Examples:

provider = Fizzy::StaticTokenProvider.new(ENV["FIZZY_ACCESS_TOKEN"])

Instance Method Summary collapse

Methods included from TokenProvider

#refresh, #refreshable?

Constructor Details

#initialize(token) ⇒ StaticTokenProvider

Returns a new instance of StaticTokenProvider.

Parameters:

  • token (String)

    the static access token

Raises:

  • (ArgumentError)


13
14
15
16
17
# File 'lib/fizzy/static_token_provider.rb', line 13

def initialize(token)
  raise ArgumentError, "token cannot be nil or empty" if token.nil? || token.empty?

  @token = token
end

Instance Method Details

#access_tokenString

Returns the access token.

Returns:

  • (String)

    the access token



20
21
22
# File 'lib/fizzy/static_token_provider.rb', line 20

def access_token
  @token
end