require 'rest-client' require 'dmao/jwt/api/errors/invalid_api_base_url' require 'dmao/jwt/api/errors/invalid_api_token' module DMAO module JWT module API class Base def self.api raise DMAO::JWT::API::Errors::InvalidApiBaseUrl.new if DMAO::JWT::API.base_url.nil? || DMAO::JWT::API.base_url.empty? raise DMAO::JWT::API::Errors::InvalidApiToken.new if DMAO::JWT::API.api_token.nil? || DMAO::JWT::API.api_token.empty? RestClient::Resource.new(DMAO::JWT::API.base_url, headers: { content_type: :json, authorization: "Bearer #{DMAO::JWT::API.api_token}" }) end end end end end