oneroster 2.3.19 → 2.3.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 131516e529d174e5a500c33ce48f40b09da2451bcb8ef3650f1cc01df51f36d0
4
- data.tar.gz: 3b584a578567e3108f68b8a42e34b6c28f3b1f905a6a6d2ebb0cf45b351391ea
3
+ metadata.gz: ac0acbc4043d8a4f9c27923592085c6dfdbcdccf982739a331514ed9dec4469a
4
+ data.tar.gz: 91d63689995e7b37a0c9814c2ebbacbd42c3d44d4e02b8502e28d8ae21c5d874
5
5
  SHA512:
6
- metadata.gz: 66659d99147c0c9e970e29a878113353f6b39cc1b659cf1552785a180a47f1274d51fe36de5d93ef72b1a2e534377aa599d8ca3f6549823d8df6f8d9f6af3f76
7
- data.tar.gz: e7eb26ca869db7c12e1abc01f72572b7016ef6c50c33f256e5b9f257ac326019fd7e1a9c9a24a69ffec4ba323de49aeb80ad5b259ed039c7625a3467c086d8cd
6
+ metadata.gz: 6516b3419a838c610b88324b9c0692241565714326b6b30efe65616c6684fce7db7c6b470bfaba1d56ca3edd2aa061a7053cd7edd3ada5ebd20ef04cd9e5402a
7
+ data.tar.gz: 83c434b84756bc076b089289f6ae7d1f4c6644c0f9730663f47985b3e493120e5c5ec9ccac703dac6ac562b01f5d68d8e30f7e1ea6b9ca3aeca7e2290f0cffa6
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oneroster (2.3.19)
4
+ oneroster (2.3.20)
5
5
  dry-inflector (~> 1.0.0)
6
6
  faraday
7
7
  faraday_middleware
@@ -48,10 +48,18 @@ module OneRoster
48
48
  records.select { |record| record_uids_set.include?(record.uid) }
49
49
  end
50
50
 
51
+ def schools
52
+ authenticate
53
+
54
+ Paginator.fetch(connection, SCHOOLS_ENDPOINT,
55
+ :get, Types::School, client: self).force
56
+ end
57
+
51
58
  def classrooms(course_codes = [])
52
59
  authenticate
53
60
 
54
61
  oneroster_classes = classes
62
+ fetched_schools = schools
55
63
 
56
64
  terms_hash = terms.each_with_object({}) { |term, terms| terms[term.uid] = term }
57
65
 
@@ -62,6 +70,7 @@ module OneRoster
62
70
  next unless course
63
71
 
64
72
  term = terms_hash[oneroster_class.term_id&.first]
73
+ school = fetched_schools.find { |school| school.uid == oneroster_class.school_uid }
65
74
 
66
75
  oneroster_classes << Types::Classroom.new(
67
76
  'id' => oneroster_class.uid,
@@ -73,7 +82,9 @@ module OneRoster
73
82
  'term_name' => term&.name,
74
83
  'term_start_date' => term&.start_date,
75
84
  'term_end_date' => term&.end_date,
76
- 'term_id' => oneroster_class.term_id
85
+ 'term_id' => oneroster_class.term_id,
86
+ 'school_name' => school&.name,
87
+ 'school_uid' => school&.uid
77
88
  )
78
89
  end
79
90
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OneRoster
4
- VERSION = '2.3.19'
4
+ VERSION = '2.3.20'
5
5
  end
data/lib/one_roster.rb CHANGED
@@ -23,6 +23,7 @@ require 'types/student'
23
23
  require 'types/teacher'
24
24
  require 'types/term'
25
25
  require 'types/admin'
26
+ require 'types/school'
26
27
 
27
28
  module OneRoster
28
29
  class DistrictNotFound < StandardError; end
@@ -35,6 +36,7 @@ module OneRoster
35
36
  CLASSES_ENDPOINT = 'ims/oneroster/v1p1/classes'
36
37
  ENROLLMENTS_ENDPOINT = 'ims/oneroster/v1p1/enrollments'
37
38
  ACADEMIC_SESSIONS_ENDPOINT = 'ims/oneroster/v1p1/academicSessions'
39
+ SCHOOLS_ENDPOINT = 'ims/oneroster/v1p1/schools'
38
40
 
39
41
  RESPONSE_TYPE_MAP = {
40
42
  'users' => 'users',
@@ -43,6 +45,7 @@ module OneRoster
43
45
  'academicSessions' => 'academicSessions',
44
46
  'courses' => 'courses',
45
47
  'classes' => 'classes',
46
- 'enrollments' => 'enrollments'
48
+ 'enrollments' => 'enrollments',
49
+ 'schools' => 'orgs'
47
50
  }.freeze
48
51
  end
data/lib/types/class.rb CHANGED
@@ -10,7 +10,8 @@ module OneRoster
10
10
  :period,
11
11
  :grades,
12
12
  :subjects,
13
- :term_id
13
+ :term_id,
14
+ :school_uid
14
15
 
15
16
  def initialize(attributes = {}, *)
16
17
  @uid = attributes['sourcedId']
@@ -21,6 +22,7 @@ module OneRoster
21
22
  @grades = presence(attributes['grades']) || []
22
23
  @subjects = presence(attributes['subjects']) || []
23
24
  @term_id = attributes.dig('terms')&.map { |term| term['sourcedId'] } || []
25
+ @school_uid = attributes.dig('school', 'sourcedId')
24
26
  @provider = 'oneroster'
25
27
  end
26
28
 
@@ -13,7 +13,9 @@ module OneRoster
13
13
  :term_name,
14
14
  :term_start_date,
15
15
  :term_end_date,
16
- :term_id
16
+ :term_id,
17
+ :school_name,
18
+ :school_uid
17
19
 
18
20
  def initialize(attributes = {})
19
21
  @uid = attributes['id']
@@ -26,6 +28,8 @@ module OneRoster
26
28
  @term_start_date = attributes['term_start_date']
27
29
  @term_end_date = attributes['term_end_date']
28
30
  @term_id = attributes['term_id']
31
+ @school_name = attributes['school_name']
32
+ @school_uid = attributes['school_uid']
29
33
  @provider = 'oneroster'
30
34
  end
31
35
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OneRoster
4
+ module Types
5
+ class School
6
+ attr_reader :uid, :name, :number
7
+
8
+ def initialize(attributes = {}, *)
9
+ @uid = attributes['sourcedId']
10
+ @name = attributes['name']
11
+ @number = attributes['identifier']
12
+ @provider = 'oneroster'
13
+ end
14
+ end
15
+ end
16
+ 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.19
4
+ version: 2.3.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Julius
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-28 00:00:00.000000000 Z
11
+ date: 2025-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -218,7 +218,7 @@ files:
218
218
  - ".rspec"
219
219
  - ".rubocop.yml"
220
220
  - ".ruby-style.yml"
221
- - ".ruby-version"
221
+ - ".tool-versions"
222
222
  - ".travis.yml"
223
223
  - Gemfile
224
224
  - Gemfile.lock
@@ -241,6 +241,7 @@ files:
241
241
  - lib/types/classroom.rb
242
242
  - lib/types/course.rb
243
243
  - lib/types/enrollment.rb
244
+ - lib/types/school.rb
244
245
  - lib/types/student.rb
245
246
  - lib/types/teacher.rb
246
247
  - lib/types/term.rb
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.4.1