Class: PetstoreApiClient::Authentication::Base
- Inherits:
-
Object
- Object
- PetstoreApiClient::Authentication::Base
- Defined in:
- lib/petstore_api_client/authentication/base.rb
Overview
Base class for authentication strategies Implements Strategy Pattern - allows different authentication methods to be swapped without changing client code
This follows the same pattern as battle-tested gems like:
-
Octokit (GitHub API client)
-
Slack-ruby-client
-
Stripe Ruby library
Instance Method Summary collapse
-
#apply(env) ⇒ void
Apply authentication to a Faraday request environment.
-
#configured? ⇒ Boolean
Check if this authentication strategy is configured Used to determine if auth should be applied.
-
#type ⇒ String
Human-readable description of authentication type Useful for logging and debugging.
Instance Method Details
#apply(env) ⇒ void
This method returns an undefined value.
Apply authentication to a Faraday request environment
18 19 20 |
# File 'lib/petstore_api_client/authentication/base.rb', line 18 def apply(env) raise NotImplementedError, "#{self.class.name} must implement #apply" end |
#configured? ⇒ Boolean
Check if this authentication strategy is configured Used to determine if auth should be applied
26 27 28 |
# File 'lib/petstore_api_client/authentication/base.rb', line 26 def configured? raise NotImplementedError, "#{self.class.name} must implement #configured?" end |
#type ⇒ String
Human-readable description of authentication type Useful for logging and debugging
34 35 36 |
# File 'lib/petstore_api_client/authentication/base.rb', line 34 def type self.class.name.split("::").last end |