Class: Martlet::Client
- Inherits:
-
Object
- Object
- Martlet::Client
- Defined in:
- lib/martlet/client.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Instance Method Summary collapse
- #courses(semester, year) ⇒ Object
- #export_calendar(filename, courses) ⇒ Object
- #grades ⇒ Object
-
#initialize(email, password) ⇒ Client
constructor
A new instance of Client.
- #schedule(semester, year) ⇒ Object
Constructor Details
#initialize(email, password) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 |
# File 'lib/martlet/client.rb', line 7 def initialize(email, password) @agent = Mechanize.new @email = email.include?('@') ? email : "#{email}@mail.mcgill.ca" authenticator = Authenticator.new(@agent) authenticator.authenticate(@email, password) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/martlet/client.rb', line 5 def email @email end |
Instance Method Details
#courses(semester, year) ⇒ Object
24 25 26 |
# File 'lib/martlet/client.rb', line 24 def courses(semester, year) schedule(semester, year).fetch_courses end |
#export_calendar(filename, courses) ⇒ Object
28 29 30 31 |
# File 'lib/martlet/client.rb', line 28 def export_calendar(filename, courses) exporter = CalendarExporter.new(filename, courses) exporter.export end |
#grades ⇒ Object
15 16 17 18 |
# File 'lib/martlet/client.rb', line 15 def grades transcript = Transcript.new(@agent) transcript.fetch_grades end |