class Icasework::Token::JWT

Generate JSON web token for OAuth API authentication

Public Class Methods

generate() click to toggle source
# File lib/icasework/token/jwt.rb, line 12
def generate
  new ::JWT.encode(payload, Icasework.secret_key, 'HS256')
end
new(token) click to toggle source
# File lib/icasework/token/jwt.rb, line 27
def initialize(token)
  @token = token
end

Private Class Methods

payload() click to toggle source
# File lib/icasework/token/jwt.rb, line 18
def payload
  {
    iss: Icasework.api_key,
    aud: Icasework::Resource.token.url,
    iat: Time.now.to_i
  }
end

Public Instance Methods

==(other) click to toggle source
# File lib/icasework/token/jwt.rb, line 35
def ==(other)
  @token == other
end
to_s() click to toggle source
# File lib/icasework/token/jwt.rb, line 31
def to_s
  @token
end