Sha256: 0c97842894519859527cb12c8021f2e44b0908fe96d0bef86aea7f8ddd0c0c8d
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Alma class Course extend Alma::ApiDefaults extend Forwardable def self.all_courses(args: {}) response = HTTParty.get("#{courses_base_path}/courses", query: args, headers: headers, timeout: timeout) if response.code == 200 Alma::CourseSet.new(get_body_from(response)) else raise StandardError, get_body_from(response) end end attr_accessor :response # The Course object can respond directly to Hash like access of attributes def_delegators :response, :[], :[]=, :has_key?, :keys, :to_json def initialize(response_body) @response = response_body end private def self.get_body_from(response) JSON.parse(response.body) end def self.courses_base_path "https://api-na.hosted.exlibrisgroup.com/almaws/v1" end def courses_base_path self.class.courses_base_path end def headers self.class.headers end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alma-0.4.0 | lib/alma/course.rb |
alma-0.3.3 | lib/alma/course.rb |
alma-0.3.2 | lib/alma/course.rb |