Sha256: 56d891c19f4e863f1c6754716942c9045419af2a301f833b2721d7f30774cc4d
Contents?: true
Size: 1.06 KB
Versions: 5
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Alma class Course extend Alma::ApiDefaults extend Forwardable def self.all_courses(args: {}) response = Net.get("#{courses_base_path}/courses", query: args, headers:, 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
alma-0.6.2 | lib/alma/course.rb |
alma-0.6.1 | lib/alma/course.rb |
alma-0.6.0 | lib/alma/course.rb |
alma-0.5.1 | lib/alma/course.rb |
alma-0.5.0 | lib/alma/course.rb |