module IntercodeClient

Constants

Client
HTTP
Schema
VERSION

Public Class Methods

decode_jwt(jwt) click to toggle source
# File lib/intercode_client.rb, line 25
def self.decode_jwt(jwt)
  JSON::JWT.decode(jwt, IntercodeClient.jwk_set)
end
intercode_url() click to toggle source
# File lib/intercode_client.rb, line 11
def self.intercode_url
  ENV['INTERCODE_URL'] || 'https://www.neilhosting.net'
end
jwk_response() click to toggle source
# File lib/intercode_client.rb, line 33
def self.jwk_response
  if !@jwk_response_last_fetched || @jwk_response_last_fetched < Time.now.to_i - 3600
    @jwk_response_last_fetched = Time.now.to_i
    @jwk_response = Net::HTTP.get(URI("#{IntercodeClient.intercode_url}/oauth/discovery/keys"))
  end

  @jwk_response
end
jwk_set() click to toggle source
# File lib/intercode_client.rb, line 29
def self.jwk_set
  JSON::JWK::Set.new(JSON.parse(jwk_response))
end