Module: MagisterData
- Included in:
- Magister
- Defined in:
- lib/magister/data.rb
Overview
Functions for getting or setting data from/to the magister apis
Instance Method Summary collapse
-
#get_classes(dateFrom, dateTo) ⇒ Object
Get all the scheduled classes between 2 dates.
-
#get_grades(count = 5, page = 0) ⇒ Object
Get a certain ammount of grades.
Instance Method Details
#get_classes(dateFrom, dateTo) ⇒ Object
Get all the scheduled classes between 2 dates
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/magister/data.rb', line 27 def get_classes(dateFrom, dateTo) if validate_date(dateFrom) && validate_date(dateTo) data = @profile.authenticatedRequest("/personen/{*id*}/afspraken?status=1&van=#{dateFrom}&tot=#{dateTo}") classes = Array.new data["Items"].each do |classItem| classes.push MagClass.new(classItem) end classes else puts "Invalid date, Format is yyyy-mm-dd" end end |
#get_grades(count = 5, page = 0) ⇒ Object
Get a certain ammount of grades.
44 45 46 47 48 49 50 51 |
# File 'lib/magister/data.rb', line 44 def get_grades(count = 5, page = 0) data = @profile.authenticatedRequest("/personen/{*id*}/cijfers/laatste?top=#{count}&skip=#{count * page}") grades = Array.new data["items"].each do |grade| grades.push Grade.new(grade) end grades end |