uqam_grade_notification 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/uqam_grade_notification +1 -1
- data/lib/uqam_grade_notification.rb +1 -0
- data/lib/uqam_grade_notification/client.rb +0 -1
- data/lib/uqam_grade_notification/notifier.rb +6 -5
- data/lib/uqam_grade_notification/student.rb +8 -7
- data/lib/uqam_grade_notification/version.rb +1 -1
- data/uqam_grade_notification.gemspec +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd36bd57e50e12a03c26f0e7221e5dd8187fe2aa
|
4
|
+
data.tar.gz: 82ed74a72b629fc08b1d25c2d999b72c0da1efef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95294dd71d5fb727c0e95ec80f294c9f884eadd82dc7cf0edd55dc6b37c7eed0c36d7edc76d0b97815e9cfcb85cf291bd6d5d49a1f01be3b0608195394889108
|
7
|
+
data.tar.gz: 9a37c6e87eb46e0140dc7a85b1d26c03d71dbab59c5cd2e4c167302d26ba60463a0ec7ff06d4cdbaf4053407661ea9e243132365956cc0d55ce2841004135029
|
data/exe/uqam_grade_notification
CHANGED
@@ -29,7 +29,7 @@ configuration =
|
|
29
29
|
if File.exist?(UqamGradeNotification::CONFIG_FILE)
|
30
30
|
JSON.parse(File.open(UqamGradeNotification::CONFIG_FILE).read)
|
31
31
|
else
|
32
|
-
configuration_cli
|
32
|
+
UqamGradeNotification.configuration_cli
|
33
33
|
end
|
34
34
|
|
35
35
|
student = UqamGradeNotification::Student.new(configuration)
|
@@ -4,11 +4,12 @@ module UqamGradeNotification
|
|
4
4
|
class Notifier
|
5
5
|
attr_reader :phone
|
6
6
|
|
7
|
-
def initialize
|
8
|
-
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@
|
7
|
+
def initialize args
|
8
|
+
args = HashWithIndifferentAccess.new(args)
|
9
|
+
@phone = args.fetch("phone")
|
10
|
+
@twilio_account_id = args.fetch("twilio_account_id")
|
11
|
+
@twilio_token = args.fetch("twilio_token")
|
12
|
+
@twilio_phone = args.fetch("twilio_phone")
|
12
13
|
end
|
13
14
|
|
14
15
|
def sms(message)
|
@@ -6,9 +6,10 @@ module UqamGradeNotification
|
|
6
6
|
class Student
|
7
7
|
attr_reader :code, :password
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
|
11
|
-
@
|
9
|
+
def initialize args
|
10
|
+
args = HashWithIndifferentAccess.new(args)
|
11
|
+
@code = args.fetch("code")
|
12
|
+
@password = args.fetch("password")
|
12
13
|
end
|
13
14
|
|
14
15
|
def grades
|
@@ -60,17 +61,17 @@ module UqamGradeNotification
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def token
|
63
|
-
@token ||=
|
64
|
+
@token ||= get_token
|
64
65
|
end
|
65
66
|
|
66
|
-
def
|
67
|
+
def get_token
|
67
68
|
connection.post do |req|
|
68
69
|
req.url "/authentification"
|
69
70
|
req.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
70
71
|
req.headers['Origin'] = 'https://portailetudiant.uqam.ca'
|
71
72
|
req.headers['Referer'] = 'https://portailetudiant.uqam.ca'
|
72
|
-
req.body = {identifiant: code, motDePasse: password}
|
73
|
-
end
|
73
|
+
req.body = {identifiant: code, motDePasse: password}
|
74
|
+
end.body["token"]
|
74
75
|
end
|
75
76
|
end
|
76
77
|
end
|
@@ -18,8 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib", "lib/uqam_grade_notification"]
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.9"
|
21
|
+
spec.add_development_dependency "rspec"
|
21
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
-
spec.add_dependency "
|
23
|
+
spec.add_dependency "activesupport"
|
23
24
|
spec.add_dependency "faraday"
|
24
25
|
spec.add_dependency "faraday_middleware"
|
25
26
|
spec.add_dependency "faraday-cookie_jar"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uqam_grade_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Croteau-Pothier
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '10.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: activesupport
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|