class LUSIAlmaCourseLoader::CLI::CourseLoader

Implements the course loader command-line interface

Public Instance Methods

extractor_details() click to toggle source

Returns a hash of named field value extractor details @return [Hash<String|Symbol, String>] the field extractor details

# File lib/lusi_alma_course_loader/cli/course_loader.rb, line 96
def extractor_details
  EXTRACTOR_DETAILS
end
extractors() click to toggle source

Returns a hash of named field value extractors @return [Hash<String|Symbol, Method|Proc>] the field extractors

# File lib/lusi_alma_course_loader/cli/course_loader.rb, line 102
def extractors
  EXTRACTORS
end
lusi_api() click to toggle source

Creates a LUSI API instance @return [LUSI::API::Core::API] the LUSI API instance

# File lib/lusi_alma_course_loader/cli/course_loader.rb, line 121
def lusi_api
  api_password = password || ENV['LUSI_API_PASSWORD'] || \
                 ENV['LUSI_WS_PASSWORD']
  api_user = user || ENV['LUSI_API_USER'] || ENV['LUSI_WS_USER']
  ::LUSI::API::Core::API.new(api_user: api_user,
                             api_password: api_password,
                             logger: logger)
end
lusi_lookup(api) click to toggle source

Creates a LUSI LookupService instance @param api [LUSI::API::Core::API] the LUSI API instance @return [LUSI::API::Core::Lookup::LookupService] the LUSI lookup service

# File lib/lusi_alma_course_loader/cli/course_loader.rb, line 133
def lusi_lookup(api)
  lookup = LUSI::API::Core::Lookup::LookupService.new(api || lusi_api)
  lookup.load
  lookup
end
reader() click to toggle source

Creates a Reader instance to retrieve course data @return [LUSIAlmaCourseLoader::Reader] the Reader instance

# File lib/lusi_alma_course_loader/cli/course_loader.rb, line 108
def reader
  return @reader unless @reader.nil?
  api = lusi_api
  lookup = lusi_lookup(api)
  @reader = ::LUSIAlmaCourseLoader::Reader.new(
    api, lookup, *time_period_list,
    current_year: current_time_period,
    filters: filter_list
  )
end