martlet 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/martlet/client.rb +12 -2
- data/lib/martlet/version.rb +1 -1
- metadata +1 -1
data/lib/martlet/client.rb
CHANGED
@@ -6,15 +6,25 @@ module Martlet
|
|
6
6
|
|
7
7
|
def initialize(email, password)
|
8
8
|
@agent = Mechanize.new
|
9
|
-
@email = email
|
9
|
+
@email = format_email(email)
|
10
10
|
|
11
11
|
authenticator = Authenticator.new(@agent)
|
12
|
-
authenticator.authenticate(email, password)
|
12
|
+
authenticator.authenticate(@email, password)
|
13
13
|
end
|
14
14
|
|
15
15
|
def grades
|
16
16
|
transcript = Transcript.new(@agent)
|
17
17
|
transcript.fetch_grades
|
18
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def format_email(email)
|
23
|
+
if email.include?('@')
|
24
|
+
email
|
25
|
+
else
|
26
|
+
"#{email}@mail.mcgill.ca"
|
27
|
+
end
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
data/lib/martlet/version.rb
CHANGED