Class: Icasework::Token::JWT

Inherits:
Object
  • Object
show all
Defined in:
lib/icasework/token/jwt.rb

Overview

Generate JSON web token for OAuth API authentication

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ JWT

Returns a new instance of JWT.



27
28
29
# File 'lib/icasework/token/jwt.rb', line 27

def initialize(token)
  @token = token
end

Class Method Details

.generateObject



12
13
14
# File 'lib/icasework/token/jwt.rb', line 12

def generate
  new ::JWT.encode(payload, Icasework.secret_key, 'HS256')
end

Instance Method Details

#==(other) ⇒ Object



35
36
37
# File 'lib/icasework/token/jwt.rb', line 35

def ==(other)
  @token == other
end

#to_sObject



31
32
33
# File 'lib/icasework/token/jwt.rb', line 31

def to_s
  @token
end