Sha256: d327cdf673a7f7a5872bde9fec58eb95751cae136c369b74df46bde7d9e754db

Contents?: true

Size: 588 Bytes

Versions: 5

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true

module Devise
  module Api
    module TokensService
      class Revoke < Devise::Api::BaseService
        option :devise_api_token, optional: true

        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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise-api-0.2.0 app/services/devise/api/tokens_service/revoke.rb
devise-api-0.1.3 app/services/devise/api/tokens_service/revoke.rb
devise-api-0.1.2 app/services/devise/api/tokens_service/revoke.rb
devise-api-0.1.1 app/services/devise/api/tokens_service/revoke.rb
devise-api-0.1.0 app/services/devise/api/tokens_service/revoke.rb