Sha256: da632e803cbc6e9850d25f135f757af6a876d218430eba8c067198f1616fc956

Contents?: true

Size: 939 Bytes

Versions: 8

Compression:

Stored size: 939 Bytes

Contents

# frozen_string_literal: true

require "logger"
require "net/http"
require "json"
require "jwt"

require_relative "open_recycling/version"
require_relative "open_recycling/resource"
require_relative "open_recycling/module_client"
require_relative "open_recycling/client_error"
require_relative "open_recycling/client"

module OpenRecycling
  class Error < StandardError; end

  def self.api_url=(url)
    @api_url = url
  end

  def self.api_url
    @api_url
  end

  def self.jwt_token=(token)
    @jwt_token = token
  end

  def self.jwt_token
    @jwt_token
  end

  def self.logger=(logger)
    @logger = logger
  end

  def self.logger
    @logger ||= Logger.new(STDOUT)
  end

  def self.generate_token(application_id:,api_key:,secret_key:,application_user_id:)
    payload = {
      sub: application_user_id,
      application_id: application_id,
      api_key: api_key
    }

    JWT.encode(payload, secret_key, "HS256")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
open_recycling-0.0.8 lib/open_recycling.rb
open_recycling-0.0.7 lib/open_recycling.rb
open_recycling-0.0.6 lib/open_recycling.rb
open_recycling-0.0.5 lib/open_recycling.rb
open_recycling-0.0.4 lib/open_recycling.rb
open_recycling-0.0.3 lib/open_recycling.rb
open_recycling-0.0.2 lib/open_recycling.rb
open_recycling-0.0.1 lib/open_recycling.rb