Sha256: 816e8f14c5d9147302addde05c5cc03798088e06a890df010dccf66489dc101f

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dmao-jwt-api-0.1.0 lib/dmao/jwt/api/base.rb