oneroster 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/one_roster/client.rb +1 -1
- data/lib/one_roster/version.rb +1 -1
- data/lib/types/teacher.rb +53 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d9b2a06cf3a50f5e78071d6a74349c39079a687
|
4
|
+
data.tar.gz: fb2d03aca728cf15aa886cf72010ede9ee14359e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 472c0969f9ce2256f1b52615a135c61411be0c4dc04466b72aea5c24bf534cb205586d1727c32b71217fa1663d9db8fbcc9fe1a350858a551e8b7929f8f7cd44
|
7
|
+
data.tar.gz: b07e234e1a1c5323e341a8fb3e0a34fd3e194c13b17431db8fea10030d73b7a1cd80ade3b21d8dc64ec88db06cfb98c139463fe3a3ae9c0d9e29a38a1f8e5cd5
|
data/Gemfile.lock
CHANGED
data/lib/one_roster/client.rb
CHANGED
data/lib/one_roster/version.rb
CHANGED
data/lib/types/teacher.rb
CHANGED
@@ -9,12 +9,59 @@ module OneRoster
|
|
9
9
|
:last_name,
|
10
10
|
:provider
|
11
11
|
|
12
|
-
def initialize(attributes = {},
|
13
|
-
@uid
|
14
|
-
@email
|
15
|
-
@first_name
|
16
|
-
@last_name
|
17
|
-
@
|
12
|
+
def initialize(attributes = {}, *, client: nil)
|
13
|
+
@uid = attributes['sourcedId']
|
14
|
+
@email = attributes['email']
|
15
|
+
@first_name = attributes['givenName']
|
16
|
+
@last_name = attributes['familyName']
|
17
|
+
@api_username = attributes['username']
|
18
|
+
@username = username(client)
|
19
|
+
@provider = 'oneroster'
|
20
|
+
end
|
21
|
+
|
22
|
+
def username(client = nil)
|
23
|
+
username_source = client&.staff_username_source
|
24
|
+
@username ||= presence(username_from(username_source))
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_h
|
28
|
+
{
|
29
|
+
uid: @uid,
|
30
|
+
email: @email,
|
31
|
+
first_name: @first_name,
|
32
|
+
last_name: @last_name,
|
33
|
+
username: @username,
|
34
|
+
provider: @provider
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def presence(field)
|
41
|
+
field unless blank?(field)
|
42
|
+
end
|
43
|
+
|
44
|
+
def blank?(field)
|
45
|
+
field.nil? || field == ''
|
46
|
+
end
|
47
|
+
|
48
|
+
def username_from(username_source)
|
49
|
+
return unless presence(username_source)
|
50
|
+
|
51
|
+
source = username_source(username_source)
|
52
|
+
|
53
|
+
presence(instance_variable_get("@#{source}"))
|
54
|
+
end
|
55
|
+
|
56
|
+
# if the username_source is `sourcedId`, we want to return `uid`
|
57
|
+
# so we can grab the right instance variable
|
58
|
+
def username_source(source)
|
59
|
+
case source
|
60
|
+
when 'sourcedId' then 'uid'
|
61
|
+
when 'username' then 'api_username'
|
62
|
+
else
|
63
|
+
source
|
64
|
+
end
|
18
65
|
end
|
19
66
|
end
|
20
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oneroster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Julius
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|