Module: FreshJwt::Store::Mixin

Defined in:
lib/fresh_jwt/store/mixin.rb

Instance Method Summary collapse

Instance Method Details

#find_by_token(token) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/fresh_jwt/store/mixin.rb', line 15

def find_by_token token
  # TODO wrap incoming method to monads
  #return super(token)
  if super(token)
    Success(token)
  else
    Failure(error: :token_not_found)
  end
end

#single_transaction(token) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/fresh_jwt/store/mixin.rb', line 5

def single_transaction token
  begin
    self.save token
    return Success()
  rescue Exception => error
    #puts error
    return Failure(error: error.message)
  end      
end