Sha256: a535b5d48106496e7d629c1b8db80329047855e115e97a97957fd2437c134a50
Contents?: true
Size: 725 Bytes
Versions: 7
Compression:
Stored size: 725 Bytes
Contents
require 'rest-client' require 'dmao/api/errors/invalid_api_base_url' require 'dmao/api/errors/invalid_api_token' module DMAO module API class Base def self.api raise Errors::InvalidApiBaseUrl.new if DMAO::API.base_url.nil? || DMAO::API.base_url.empty? raise Errors::InvalidApiToken.new if DMAO::API.api_token.nil? || DMAO::API.api_token.empty? if DMAO::API.institution_id.nil? base_url = DMAO::API.base_url else base_url = DMAO::API.base_url + "/institutions/#{DMAO::API.institution_id}" end RestClient::Resource.new(base_url, headers: { content_type: :json, authorization: "Bearer #{DMAO::API.api_token}" }) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems