Class: ResoTransport::Authentication::StaticTokenAuth
- Inherits:
-
AuthStrategy
- Object
- AuthStrategy
- ResoTransport::Authentication::StaticTokenAuth
- Defined in:
- lib/reso_transport/authentication/static_token_auth.rb
Overview
A simple auth strategy that uses a static, non-expiring token.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#token_type ⇒ Object
readonly
Returns the value of attribute token_type.
Attributes inherited from AuthStrategy
Instance Method Summary collapse
-
#authenticate ⇒ Access
Simply returns a static, never expiring access token.
-
#initialize(options) ⇒ StaticTokenAuth
constructor
A new instance of StaticTokenAuth.
Methods inherited from AuthStrategy
Constructor Details
#initialize(options) ⇒ StaticTokenAuth
Returns a new instance of StaticTokenAuth.
8 9 10 11 |
# File 'lib/reso_transport/authentication/static_token_auth.rb', line 8 def initialize() @access_token = .fetch(:access_token) @token_type = .fetch(:token_type, "Bearer") end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/reso_transport/authentication/static_token_auth.rb', line 5 def access_token @access_token end |
#token_type ⇒ Object (readonly)
Returns the value of attribute token_type.
6 7 8 |
# File 'lib/reso_transport/authentication/static_token_auth.rb', line 6 def token_type @token_type end |
Instance Method Details
#authenticate ⇒ Access
Simply returns a static, never expiring access token
15 16 17 18 19 20 21 |
# File 'lib/reso_transport/authentication/static_token_auth.rb', line 15 def authenticate Access.new( access_token: access_token, token_type: token_type, expires_in: 1 << (1.size * 8 - 2) - 1 # Max int value ) end |