Sha256: 953ba51eaf1ed375e6158a8b1b3b0228c1f64a7ff5068a1fcbff676fde9f5171
Contents?: true
Size: 1.04 KB
Versions: 10
Compression:
Stored size: 1.04 KB
Contents
require 'httpi' require 'json' require 'active_support/core_ext/string' require 'xporter_on_demand/utils' module XporterOnDemand class Client include XporterOnDemand::API include XporterOnDemand::Utils attr_reader :token, :available_scopes, :estab, :uri def initialize(token = nil, args = {}) @token = token @args = args details = token_details @available_scopes = details["Scopes"] @estab = @args.delete(:estab) @estab ||= details["Estab"] args[:edubase] ? edubase_client : school_client end %i(token_details scopes queries logs usage).each do |endpoint| define_method(endpoint){ get_info(endpoint.to_s.camelcase) } end def school_client @uri = API_PATH + "School/" + estab + "/" end # This is not finished and probably won't even work. def edubase_client @uri = API_PATH + "RunQuery/?" end private def get_info(endpoint) get(url: API_PATH + endpoint) end end end
Version data entries
10 entries across 10 versions & 1 rubygems