Class: Devise::Api::TokensService::Revoke

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/devise/api/tokens_service/revoke.rb

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
# File 'app/services/devise/api/tokens_service/revoke.rb', line 9

def call
  return Success(devise_api_token) if devise_api_token.blank?
  return Success(devise_api_token) if devise_api_token.revoked? || devise_api_token.expired?
  return Success(devise_api_token) if devise_api_token.update(revoked_at: Time.zone.now)

  Failure(error: :devise_api_token_revoke_error, record: devise_api_token)
end