Scraping for grades

Published on . Takes about 1 minute to read.

The student information system (ÕIS) our college is using satisfies most (if not all) the requirements presented to it. Still, I found a fault: there’s no API and I wanted to get notified ASAP when a new grade is added. Some background: I recently started a wonderful online learning course: SAAS-class.org (https://www.coursera.org/saas/class) where I got the opportunity & incentive to dive into Ruby (on Rails). So, my first ever Ruby class was born. The code uses Mechanize to log into the grade system, navigates to the correct page and scrapes the grades into an Hash structure. The end user can basically just do this:

require "itk_grades"
# Create instance and save login data
ITK = ITKGrades.new("user", "pass")
# Fetch & scrape grades from ÕIS.
ITK.fetch
#ITK.grades # Returns a hash of all grades
# Print all grades
ITK.print

You can see the full code over @ GitHub or the college Wiki (in Estonian). Screenshot