Class: ResoTransport::Authentication::AuthStrategy
- Inherits:
-
Object
- Object
- ResoTransport::Authentication::AuthStrategy
- Defined in:
- lib/reso_transport/authentication/auth_strategy.rb
Overview
This base class defines the basic interface support by all client authentication implementations.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access ⇒ Object
readonly
Returns the value of attribute access.
Instance Method Summary collapse
-
#authenticate ⇒ Access
abstract
The access token object.
-
#ensure_valid_access! ⇒ Object
Ensure that a valid access token is present or raise an exception.
-
#reset ⇒ Object
Resets access.
Instance Attribute Details
#access ⇒ Object (readonly)
Returns the value of attribute access.
5 6 7 |
# File 'lib/reso_transport/authentication/auth_strategy.rb', line 5 def access @access end |
Instance Method Details
#authenticate ⇒ Access
This method is abstract.
Perform requests to authenticate the client with the API
Returns The access token object.
9 10 11 |
# File 'lib/reso_transport/authentication/auth_strategy.rb', line 9 def authenticate(*) raise NotImplementedError, 'Implement me!' end |
#ensure_valid_access! ⇒ Object
Ensure that a valid access token is present or raise an exception
15 16 17 18 |
# File 'lib/reso_transport/authentication/auth_strategy.rb', line 15 def ensure_valid_access! @access = authenticate unless access && access.valid? access end |
#reset ⇒ Object
Resets access
21 22 23 |
# File 'lib/reso_transport/authentication/auth_strategy.rb', line 21 def reset @access = nil end |