Class: Redd::AuthStrategies::Script
- Inherits:
-
AuthStrategy
- Object
- Client
- AuthStrategy
- Redd::AuthStrategies::Script
- Defined in:
- lib/redd/auth_strategies/script.rb
Overview
A password-based authentication scheme. Requests all scopes.
Constant Summary
Constants inherited from AuthStrategy
Constants inherited from Client
Instance Method Summary collapse
-
#authenticate ⇒ Access
Perform authentication and return the resulting access object.
-
#initialize(client_id:, secret:, username:, password:, **kwargs) ⇒ Script
constructor
A new instance of Script.
-
#refresh(_) ⇒ Access
Refresh the authentication and return the refreshed access.
Methods inherited from AuthStrategy
Methods inherited from Client
#delete, #get, #patch, #post, #put, #request
Constructor Details
#initialize(client_id:, secret:, username:, password:, **kwargs) ⇒ Script
Returns a new instance of Script.
9 10 11 12 13 |
# File 'lib/redd/auth_strategies/script.rb', line 9 def initialize(client_id:, secret:, username:, password:, **kwargs) super(client_id: client_id, secret: secret, **kwargs) @username = username @password = password end |
Instance Method Details
#authenticate ⇒ Access
Perform authentication and return the resulting access object
17 18 19 |
# File 'lib/redd/auth_strategies/script.rb', line 17 def authenticate request_access('password', username: @username, password: @password) end |
#refresh(_) ⇒ Access
Refresh the authentication and return the refreshed access
23 24 25 |
# File 'lib/redd/auth_strategies/script.rb', line 23 def refresh(_) authenticate end |