class UqamGradeNotification::Client
Attributes
notifier[R]
storage[R]
student[R]
Public Class Methods
new(student, notifier, storage)
click to toggle source
# File lib/uqam_grade_notification/client.rb, line 5 def initialize(student, notifier, storage) @student = student @notifier = notifier @storage = storage end
Public Instance Methods
grades_have_changed?()
click to toggle source
# File lib/uqam_grade_notification/client.rb, line 22 def grades_have_changed? md5 = Digest::MD5.new md5.hexdigest(student.grades.to_json) == md5.hexdigest(student_last_grades.to_json) end
notify_of_changes()
click to toggle source
# File lib/uqam_grade_notification/client.rb, line 11 def notify_of_changes if grades_have_changed? p "Grades have not changed since last checked." else message = "Your grades have been updated!" p message save_student_grades notifier.sms(message) end end
save_student_grades()
click to toggle source
# File lib/uqam_grade_notification/client.rb, line 31 def save_student_grades storage.save_grades(student) end
student_last_grades()
click to toggle source
# File lib/uqam_grade_notification/client.rb, line 27 def student_last_grades @last_grades ||= storage.last_grades(student) end