class Alma::Course

Attributes

response[RW]

Public Class Methods

all_courses(args: {}) click to toggle source
# File lib/alma/course.rb, line 8
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
new(response_body) click to toggle source
# File lib/alma/course.rb, line 25
def initialize(response_body)
  @response = response_body
end

Private Class Methods

courses_base_path() click to toggle source
# File lib/alma/course.rb, line 35
def self.courses_base_path
  "https://api-na.hosted.exlibrisgroup.com/almaws/v1"
end
get_body_from(response) click to toggle source
# File lib/alma/course.rb, line 31
def self.get_body_from(response)
  JSON.parse(response.body)
end

Private Instance Methods

courses_base_path() click to toggle source
# File lib/alma/course.rb, line 39
def courses_base_path
  self.class.courses_base_path
end
headers() click to toggle source
# File lib/alma/course.rb, line 43
def headers
  self.class.headers
end