Class: Alma::Course

Inherits:
Object
  • Object
show all
Extended by:
ApiDefaults, Forwardable
Defined in:
lib/alma/course.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApiDefaults

apikey, bibs_base_path, configuration_base_path, items_base_path, region, timeout, users_base_path

Constructor Details

#initialize(response_body) ⇒ Course

Returns a new instance of Course.



25
26
27
# File 'lib/alma/course.rb', line 25

def initialize(response_body)
  @response = response_body
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



20
21
22
# File 'lib/alma/course.rb', line 20

def response
  @response
end

Class Method Details

.all_courses(args: {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/alma/course.rb', line 8

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