clever 3.2.1 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/clever/client.rb +21 -3
- data/lib/clever/types/district_admin.rb +1 -2
- data/lib/clever/types/school_admin.rb +1 -2
- data/lib/clever/types/student.rb +2 -4
- data/lib/clever/types/teacher.rb +2 -5
- data/lib/clever/version.rb +1 -1
- data/lib/clever.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 985e7dabb5519438c2f431d5d9e7d696101b1d9d
|
4
|
+
data.tar.gz: b369ac82a20a197ce7c21481b8926173e3296970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a9b232e15d9f528673c4f45052b2fea6671035d48162dddcc3feda3e267f04498a26c00cf0cacbd0b06252ded0761c245106883d5a9aba85436e8a45fd6b132
|
7
|
+
data.tar.gz: 36d53400d82dbe14bf7109da24e16a5470f65c057af86410358c5a678a5cac047f4b8855115eec772fc2a2117f73aa736599ac2f580259a46b00369c15eb4f6b
|
data/.circleci/config.yml
CHANGED
@@ -22,7 +22,7 @@ install_dependencies: &install_dependencies
|
|
22
22
|
command: |
|
23
23
|
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
24
24
|
source $BASH_ENV
|
25
|
-
gem install bundler
|
25
|
+
gem install bundler -v '2.1.4'
|
26
26
|
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
27
27
|
|
28
28
|
save_ruby_cache: &save_ruby_cache
|
data/Gemfile.lock
CHANGED
data/lib/clever/client.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Clever
|
4
4
|
class Client
|
5
|
-
attr_accessor :app_id, :app_token, :sync_id, :logger,
|
5
|
+
attr_accessor :app_id, :app_token, :sync_id, :logger, :redirect_uri,
|
6
6
|
:vendor_key, :vendor_secret, :username_source, :staff_username_source
|
7
7
|
|
8
8
|
attr_reader :api_url, :tokens_endpoint
|
@@ -38,6 +38,22 @@ module Clever
|
|
38
38
|
response
|
39
39
|
end
|
40
40
|
|
41
|
+
def user_uid_for_code(code)
|
42
|
+
response = connection.execute(USER_TOKEN_ENDPOINT,
|
43
|
+
:post,
|
44
|
+
nil,
|
45
|
+
{ code: code,
|
46
|
+
grant_type: 'authorization_code',
|
47
|
+
redirect_uri: redirect_uri })
|
48
|
+
|
49
|
+
fail ConnectionError, response.raw_body unless response.success?
|
50
|
+
|
51
|
+
connection.set_token(response.raw_body['access_token'])
|
52
|
+
|
53
|
+
response = connection.execute(ME_ENDPOINT, :get)
|
54
|
+
response&.body&.dig('id')
|
55
|
+
end
|
56
|
+
|
41
57
|
def most_recent_event
|
42
58
|
authenticate
|
43
59
|
|
@@ -65,7 +81,8 @@ module Clever
|
|
65
81
|
|
66
82
|
return records if record_uids.empty?
|
67
83
|
|
68
|
-
|
84
|
+
record_uids_set = record_uids.to_set
|
85
|
+
records.select { |record| record_uids_set.include?(record.uid) }
|
69
86
|
end
|
70
87
|
end
|
71
88
|
|
@@ -82,7 +99,8 @@ module Clever
|
|
82
99
|
|
83
100
|
return admins if record_uids.empty?
|
84
101
|
|
85
|
-
|
102
|
+
record_uids_set = record_uids.to_set
|
103
|
+
admins.select { |record| record_uids_set.include?(record.uid) }
|
86
104
|
end
|
87
105
|
|
88
106
|
# discard params to make the API behave the same as the one roster gem
|
@@ -8,9 +8,8 @@ module Clever
|
|
8
8
|
@email = attributes['email']
|
9
9
|
@first_name = attributes['name']['first']
|
10
10
|
@last_name = attributes['name']['last']
|
11
|
-
@legacy_id = attributes.dig('roles', 'district_admin', 'legacy_id')
|
12
11
|
@provider = 'clever'
|
13
|
-
@sis_id = attributes.dig('roles', 'district_admin', '
|
12
|
+
@sis_id = attributes.dig('roles', 'district_admin', 'sis_id')
|
14
13
|
@uid = attributes['id']
|
15
14
|
@username = username(client)
|
16
15
|
@role = 'admin'
|
@@ -8,9 +8,8 @@ module Clever
|
|
8
8
|
@email = attributes['email']
|
9
9
|
@first_name = attributes['name']['first']
|
10
10
|
@last_name = attributes['name']['last']
|
11
|
-
@legacy_id = attributes.dig('roles', 'staff', 'legacy_id')
|
12
11
|
@provider = 'clever'
|
13
|
-
@sis_id = attributes.dig('roles', 'staff', '
|
12
|
+
@sis_id = attributes.dig('roles', 'staff', 'sis_id')
|
14
13
|
@uid = attributes['id']
|
15
14
|
@username = username(client)
|
16
15
|
@role = 'admin'
|
data/lib/clever/types/student.rb
CHANGED
@@ -6,17 +6,15 @@ module Clever
|
|
6
6
|
attr_reader :uid,
|
7
7
|
:first_name,
|
8
8
|
:last_name,
|
9
|
-
:provider
|
10
|
-
:legacy_id
|
9
|
+
:provider
|
11
10
|
|
12
11
|
def initialize(attributes = {}, client: nil)
|
13
12
|
@district_username = attributes.dig('credentials', 'district_username')
|
14
13
|
@email = attributes['email']
|
15
14
|
@first_name = attributes['name']['first']
|
16
15
|
@last_name = attributes['name']['last']
|
17
|
-
@legacy_id = attributes.dig('roles', 'student', 'legacy_id')
|
18
16
|
@provider = 'clever'
|
19
|
-
@sis_id = attributes
|
17
|
+
@sis_id = attributes.dig('roles', 'student', 'sis_id')
|
20
18
|
@uid = attributes['id']
|
21
19
|
@username = username(client)
|
22
20
|
end
|
data/lib/clever/types/teacher.rb
CHANGED
@@ -8,7 +8,6 @@ module Clever
|
|
8
8
|
:first_name,
|
9
9
|
:last_name,
|
10
10
|
:provider,
|
11
|
-
:legacy_id,
|
12
11
|
:role
|
13
12
|
|
14
13
|
def initialize(attributes = {}, *, client: nil)
|
@@ -16,9 +15,8 @@ module Clever
|
|
16
15
|
@email = attributes['email']
|
17
16
|
@first_name = attributes['name']['first']
|
18
17
|
@last_name = attributes['name']['last']
|
19
|
-
@legacy_id = attributes.dig('roles', 'teacher', 'legacy_id')
|
20
18
|
@provider = 'clever'
|
21
|
-
@sis_id = attributes.dig('roles', 'teacher', '
|
19
|
+
@sis_id = attributes.dig('roles', 'teacher', 'sis_id')
|
22
20
|
@uid = attributes['id']
|
23
21
|
@username = username(client)
|
24
22
|
@role = 'teacher'
|
@@ -37,8 +35,7 @@ module Clever
|
|
37
35
|
first_name: @first_name,
|
38
36
|
last_name: @last_name,
|
39
37
|
username: @username,
|
40
|
-
provider: @provider
|
41
|
-
legacy_id: @legacy_id
|
38
|
+
provider: @provider
|
42
39
|
}
|
43
40
|
end
|
44
41
|
|
data/lib/clever/version.rb
CHANGED
data/lib/clever.rb
CHANGED
@@ -24,6 +24,8 @@ require 'clever/types/token'
|
|
24
24
|
|
25
25
|
module Clever
|
26
26
|
API_URL = 'https://api.clever.com/v3.0'
|
27
|
+
ME_ENDPOINT = '/v3.0/me'
|
28
|
+
USER_TOKEN_ENDPOINT = 'https://clever.com/oauth/tokens'
|
27
29
|
TOKENS_ENDPOINT = 'https://clever.com/oauth/tokens?owner_type=district'
|
28
30
|
STUDENTS_ENDPOINT = '/v3.0/users?role=student'
|
29
31
|
COURSES_ENDPOINT = '/v3.0/courses'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Julius
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -210,7 +210,7 @@ licenses:
|
|
210
210
|
- MIT
|
211
211
|
metadata:
|
212
212
|
allowed_push_host: https://rubygems.org
|
213
|
-
post_install_message:
|
213
|
+
post_install_message:
|
214
214
|
rdoc_options: []
|
215
215
|
require_paths:
|
216
216
|
- lib
|
@@ -225,9 +225,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
|
-
rubyforge_project:
|
229
|
-
rubygems_version: 2.6.
|
230
|
-
signing_key:
|
228
|
+
rubyforge_project:
|
229
|
+
rubygems_version: 2.6.11
|
230
|
+
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Wrapper for the Clever API.
|
233
233
|
test_files: []
|