Class: LUSIAlmaCourseLoader::Reader
- Inherits:
-
AlmaCourseLoader::Reader
- Object
- AlmaCourseLoader::Reader
- LUSIAlmaCourseLoader::Reader
- Includes:
- Helpers
- Defined in:
- lib/lusi_alma_course_loader/reader.rb
Overview
Reads course information from LUSI
Constant Summary collapse
- PROCESSING_DEPARTMENT =
Alma processing department code
'Library'.freeze
- TERMS =
Alma term codes
{ lusi_lent: 'LENT', lusi_mich: 'MICHAELMAS', lusi_summ: 'SUMMER' }.freeze
Constants included from Helpers
Helpers::COURSE_ID_OFFSETS, Helpers::INSTRUCTOR_ROLES
Instance Method Summary collapse
-
#initialize(lusi_api = nil, lusi_lookup = nil, *years, **kwargs) ⇒ void
constructor
Initializes a new Reader instance.
-
#years(year = nil, years_previous: nil, years_next: nil) ⇒ Object
Returns a list of LUSI year instances.
Methods included from Helpers
#course_department, #course_id, #department, #departments, #field, #instructor_enrolments, #instructor_roles, #instructor_usernames, #org_units
Constructor Details
#initialize(lusi_api = nil, lusi_lookup = nil, *years, **kwargs) ⇒ void
Initializes a new Reader instance
172 173 174 175 176 177 178 179 |
# File 'lib/lusi_alma_course_loader/reader.rb', line 172 def initialize(lusi_api = nil, lusi_lookup = nil, *years, **kwargs) # Set the LUSI API and lookup properties for use with subsequent methods @lusi_api = lusi_api @lusi_lookup = lusi_lookup super(*years, **kwargs) @departments = departments @instructor_roles = instructor_roles end |
Instance Method Details
#years(year = nil, years_previous: nil, years_next: nil) ⇒ Object
Returns a list of LUSI year instances
187 188 189 190 191 192 193 194 |
# File 'lib/lusi_alma_course_loader/reader.rb', line 187 def years(year = nil, years_previous: nil, years_next: nil) years_next = years_next.to_i years_previous = years_previous.to_i result = [] result.push(*(year.previous(years_previous))) if years_previous > 0 result.push(*(year.next(years_next))) if years_next > 0 result end |