class Lector

Constants

VERSION

Attributes

logged_in[R]

Public Class Methods

new(config) click to toggle source
# File lib/lector.rb, line 34
def initialize(config)
  puts "Lector v#{VERSION}"

  # Fill in any blanks
  @config = @@defaults.merge(config)
  load_veracross

  # First try to login to Moodle
  login_to_moodle

  # Connect to DB
  connect_db

  nil
end

Public Instance Methods

scrape_and_save(id, type) click to toggle source
# File lib/lector.rb, line 50
def scrape_and_save(id, type)
  puts "Scraping and saving #{type.to_s} with Moodle ID #{id}"
  begin
    return case type
      when :person
        save_person(extract_person(id))
      when :course
        save_course(extract_course(id))
    end
  rescue => e
    puts "Failed to scrape and save #{type.to_s} with ID: #{id}\n#{e}"
  end
end