oneroster 2.0.0 → 2.0.1
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.rb +8 -5
- data/lib/one_roster/client.rb +18 -1
- data/lib/one_roster/version.rb +1 -1
- data/lib/types/class.rb +3 -1
- data/lib/types/classroom.rb +13 -7
- data/lib/types/term.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56b1e4481ec56f6041edd31f16457ace9bd84d88
|
4
|
+
data.tar.gz: 364a22aeaa63d58c65997563a239e549e1fbd70a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a4b44c8e3e518fc65bb7ca287b7ace69f5a036b82def7c33f2fbccc5aae60188efe7152e012a4bd4878dbd58512f28d15f1b4557ba95d59432d1226ec3e260
|
7
|
+
data.tar.gz: 7940dcec5c164d80229032579927374c9b2c9d539d15a30ed8423002ad35795de980152252a58b04b04371762a4c9c76a47e675fd22fabafdc91f0efafecb383
|
data/Gemfile.lock
CHANGED
data/lib/one_roster.rb
CHANGED
@@ -21,19 +21,22 @@ require 'types/classroom'
|
|
21
21
|
require 'types/enrollment'
|
22
22
|
require 'types/student'
|
23
23
|
require 'types/teacher'
|
24
|
+
require 'types/term'
|
24
25
|
|
25
26
|
module OneRoster
|
26
27
|
class DistrictNotFound < StandardError; end
|
27
28
|
class ConnectionError < StandardError; end
|
28
29
|
|
29
|
-
STUDENTS_ENDPOINT
|
30
|
-
TEACHERS_ENDPOINT
|
31
|
-
COURSES_ENDPOINT
|
32
|
-
CLASSES_ENDPOINT
|
33
|
-
ENROLLMENTS_ENDPOINT
|
30
|
+
STUDENTS_ENDPOINT = 'ims/oneroster/v1p1/students'
|
31
|
+
TEACHERS_ENDPOINT = 'ims/oneroster/v1p1/teachers'
|
32
|
+
COURSES_ENDPOINT = 'ims/oneroster/v1p1/courses'
|
33
|
+
CLASSES_ENDPOINT = 'ims/oneroster/v1p1/classes'
|
34
|
+
ENROLLMENTS_ENDPOINT = 'ims/oneroster/v1p1/enrollments'
|
35
|
+
ACADEMIC_SESSIONS_ENDPOINT = 'ims/oneroster/v1p1/academicSessions'
|
34
36
|
|
35
37
|
RESPONSE_TYPE_MAP = {
|
36
38
|
'teachers' => 'users',
|
39
|
+
'academicSessions' => 'academicSessions',
|
37
40
|
'students' => 'users',
|
38
41
|
'courses' => 'courses',
|
39
42
|
'classes' => 'classes',
|
data/lib/one_roster/client.rb
CHANGED
@@ -40,22 +40,39 @@ module OneRoster
|
|
40
40
|
|
41
41
|
oneroster_classes = classes
|
42
42
|
|
43
|
+
terms_hash = terms.each_with_object({}) { |term, terms| terms[term.uid] = term }
|
44
|
+
|
43
45
|
courses = courses(course_codes, oneroster_classes)
|
44
46
|
|
45
47
|
oneroster_classes.each_with_object([]) do |oneroster_class, oneroster_classes|
|
46
48
|
course = courses.find { |course| course.uid == oneroster_class.course_uid }
|
47
49
|
next unless course
|
48
50
|
|
51
|
+
term = terms_hash[oneroster_class.term_id]
|
52
|
+
|
49
53
|
oneroster_classes << Types::Classroom.new(
|
50
54
|
'id' => oneroster_class.uid,
|
51
55
|
'name' => oneroster_class.title,
|
52
56
|
'course_number' => course.course_code,
|
53
57
|
'period' => oneroster_class.period,
|
54
|
-
'grades' => oneroster_class.grades
|
58
|
+
'grades' => oneroster_class.grades,
|
59
|
+
'term_name' => term&.name,
|
60
|
+
'term_start_date' => term&.start_date,
|
61
|
+
'term_end_date' => term&.end_date
|
55
62
|
)
|
56
63
|
end
|
57
64
|
end
|
58
65
|
|
66
|
+
def terms
|
67
|
+
authenticate
|
68
|
+
|
69
|
+
endpoint = OneRoster::ACADEMIC_SESSIONS_ENDPOINT
|
70
|
+
|
71
|
+
type = Types::Term
|
72
|
+
|
73
|
+
Paginator.fetch(connection, endpoint, :get, type, client: self).force
|
74
|
+
end
|
75
|
+
|
59
76
|
def courses(course_codes = [], oneroster_classes = classes)
|
60
77
|
authenticate
|
61
78
|
|
data/lib/one_roster/version.rb
CHANGED
data/lib/types/class.rb
CHANGED
@@ -8,7 +8,8 @@ module OneRoster
|
|
8
8
|
:course_uid,
|
9
9
|
:provider,
|
10
10
|
:period,
|
11
|
-
:grades
|
11
|
+
:grades,
|
12
|
+
:term_id
|
12
13
|
|
13
14
|
def initialize(attributes = {}, *)
|
14
15
|
@uid = attributes['sourcedId']
|
@@ -17,6 +18,7 @@ module OneRoster
|
|
17
18
|
@status = attributes['status']
|
18
19
|
@period = first_period(attributes) || period_from_code(attributes)
|
19
20
|
@grades = attributes['grades']
|
21
|
+
@term_id = attributes['terms'][0]['sourcedId']
|
20
22
|
@provider = 'oneroster'
|
21
23
|
end
|
22
24
|
|
data/lib/types/classroom.rb
CHANGED
@@ -8,15 +8,21 @@ module OneRoster
|
|
8
8
|
:course_number,
|
9
9
|
:period,
|
10
10
|
:grades,
|
11
|
-
:provider
|
11
|
+
:provider,
|
12
|
+
:term_name,
|
13
|
+
:term_start_date,
|
14
|
+
:term_end_date
|
12
15
|
|
13
16
|
def initialize(attributes = {})
|
14
|
-
@uid
|
15
|
-
@name
|
16
|
-
@course_number
|
17
|
-
@period
|
18
|
-
@grades
|
19
|
-
@
|
17
|
+
@uid = attributes['id']
|
18
|
+
@name = attributes['name']
|
19
|
+
@course_number = attributes['course_number']
|
20
|
+
@period = attributes['period']
|
21
|
+
@grades = attributes['grades']
|
22
|
+
@term_name = attributes['term_name']
|
23
|
+
@term_start_date = attributes['term_start_date']
|
24
|
+
@term_end_date = attributes['term_end_date']
|
25
|
+
@provider = 'oneroster'
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
data/lib/types/term.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OneRoster
|
4
|
+
module Types
|
5
|
+
class Term < Base
|
6
|
+
attr_reader :uid,
|
7
|
+
:name,
|
8
|
+
:start_date,
|
9
|
+
:end_date
|
10
|
+
|
11
|
+
def initialize(attributes = {}, *)
|
12
|
+
@uid = attributes['sourcedId']
|
13
|
+
@name = attributes['title']
|
14
|
+
@start_date = attributes['startDate']
|
15
|
+
@end_date = attributes['endDate']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
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.0.
|
4
|
+
version: 2.0.1
|
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-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- lib/types/enrollment.rb
|
244
244
|
- lib/types/student.rb
|
245
245
|
- lib/types/teacher.rb
|
246
|
+
- lib/types/term.rb
|
246
247
|
- one_roster.gemspec
|
247
248
|
homepage: https://github.com/TCI/oneroster
|
248
249
|
licenses:
|