Class: RubyUW::CurriculumEnrollment

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyuw/curriculum_enrollment.rb

Overview

RubyUW::CurriculumEnrollment is used to extract SLN information for an entire “curriculum” of courses (whic is how MyUW refers to it). If you have multiple SLNs within the same curriculum (chemistry, computer science, history, etc.), it is more efficient to use the CurriculumEnrollment class rather than SLN.

Requires authentication with RubyUW::Base prior to use!

Usage Examples

require 'rubyuw'
RubyUW::Base.authenticate("netid", "password")
curriculum = RubyUW::CurriculumEnrollment.find("HIST")
curriculum["12345"] # RubyUW::SLN object. Use it like one!

After using CurriculumEnrollment to grab the SLNs of a specific curriculum, you can access the individual SLNs using the array access notation common to ruby. This access returns a SLN object.

Class Method Summary collapse

Class Method Details

.find(curriculum, term) ⇒ Object

Pulls data about a specific curriculum. The SLN data is pulled directly from the MyUW curriculum information page. Authentication is required prior to use.

Parameters:

  • Curriculum (String)

    to search for.

  • The (String)

    term (quarter) to search in.



29
30
31
32
33
34
35
36
37
38
# File 'lib/rubyuw/curriculum_enrollment.rb', line 29

def find(curriculum, term)
  raise Errors::NotLoggedInError.new unless Base.authenticated?

  page = Base.connection.get("https://sdb.admin.washington.edu/timeschd/uwnetid/tsstat.asp?QTRYR=#{term}&CURRIC=#{curriculum}")
  raise Errors::CurriculumDoesNotExistError.new if !curriculum_exists?(page)
  
  extract_courses(page, term)
rescue WWW::Mechanize::ResponseCodeError
  raise Errors::CurriculumDoesNotExistError.new
end