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: ( 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 ="user", "pass")
# Fetch & scrape grades from ÕIS.
#ITK.grades # Returns a hash of all grades
# Print all grades

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