Class: OctopusAuth::Revoke
- Inherits:
-
Object
- Object
- OctopusAuth::Revoke
- Defined in:
- lib/octopus_auth/revoke.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(access_token_value) ⇒ Revoke
constructor
A new instance of Revoke.
Constructor Details
#initialize(access_token_value) ⇒ Revoke
Returns a new instance of Revoke.
3 4 5 6 7 8 9 |
# File 'lib/octopus_auth/revoke.rb', line 3 def initialize(access_token_value) @access_token = OctopusAuth.configuration.model_class.find_by(token: access_token_value) unless @access_token raise OctopusAuth::Errors::TokenNotFoundError.new("API Access token #{access_token_value} is not found") end end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/octopus_auth/revoke.rb', line 11 def execute @access_token.expired_at = Time.now.utc @access_token.active = false @access_token.save! OctopusAuth::Decorators::Default.new(@access_token) end |