Class: FreshJwt::StoreOld

Inherits:
Object
  • Object
show all
Defined in:
lib/fresh_jwt/store_old.rb

Constant Summary collapse

@@store =
[]

Class Method Summary collapse

Class Method Details

.allObject



20
21
22
# File 'lib/fresh_jwt/store_old.rb', line 20

def self.all
  @@store
end

.find_by_token(token) ⇒ Object



24
25
26
# File 'lib/fresh_jwt/store_old.rb', line 24

def self.find_by_token token
  @@store.find{ |t| t.token == token }
end

.get(token) ⇒ Object



17
18
19
# File 'lib/fresh_jwt/store_old.rb', line 17

def self.get token
  @@store.find{ |t| t == token }
end

.save(token) ⇒ Object

{

"token_value": {
  jti: 1,
  exp: 2,
  type: :access
}

}



13
14
15
16
# File 'lib/fresh_jwt/store_old.rb', line 13

def self.save token
  
  @@store << token
end

.single_transaction(token) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/fresh_jwt/store_old.rb', line 28

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

.transaction(&block) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/fresh_jwt/store_old.rb', line 38

def self.transaction &block
  begin
    block.call
    return Success()
  rescue Exception => error

    puts error
    return Failure(error: error.message)
  end
end