oneroster 2.3.25 → 2.3.26

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: 8db39f6cbbcf9c017c6f3e45d1d2c20ce4729e1aaee42c0bab9df7f86c98a5fb
4
- data.tar.gz: 287a5336c41d5a331b259fc6f6e868c78407ecf112b316f46614f0ef88f38ed9
3
+ metadata.gz: 189445ee35d9472f9324ad96eae0c56df171d0200c20f1c33ef0507e155de2a4
4
+ data.tar.gz: 3e1886bdbf60a197ec1b37d0b47cb9563d921ff1fe9f1a5d5497eab07ec5b5f3
5
5
  SHA512:
6
- metadata.gz: c2d1839f015badde5414be3101fe12c80f8a69944be704e2ee0ee0ed1cfeae86e0dfc067b9bfeeaba2caf03f0e4f8b0cd763c1dc7be472226ec841a468ec44cb
7
- data.tar.gz: 3aef5eece6020dba745992702dbaa71d58e8f4aac97ffb90e997812f69c5ea9c0194d05b7343bccfe2c3d20825390f74650c08f69ce414b7e9d01b210aa5a7a4
6
+ metadata.gz: 3213057e6555cbb9db4c68c9cb33b4206c652e1748a0d95498b6f37168b01f62b7430986825b4394a8495176d1410b7638f27544ecb9492118dfaba276c2cf36
7
+ data.tar.gz: c385bca6f5e59fe35169a2fab47184b223bcc97c214ff15b87a344dbe21dae103cd26e2eca4528ef71e14fd468b5ebd3aabc17b45f1bec9d34479edd980b35aa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oneroster (2.3.25)
4
+ oneroster (2.3.26)
5
5
  dry-inflector (~> 1.0.0)
6
6
  faraday
7
7
  faraday_middleware
@@ -7,7 +7,8 @@ module OneRoster
7
7
  :username_source, :oauth_strategy, :staff_username_source, :token_content_type,
8
8
  :sentry_client, :only_provision_current_terms,
9
9
  :student_username_search_for, :staffer_username_search_for,
10
- :student_username_replace_with, :staffer_username_replace_with, :ca_cert_path
10
+ :student_username_replace_with, :staffer_username_replace_with, :ca_cert_path,
11
+ :service_account, :endpoint_prefix, :scope
11
12
 
12
13
  attr_reader :authenticated
13
14
 
@@ -22,11 +23,21 @@ module OneRoster
22
23
  client
23
24
  end
24
25
 
26
+ %i(students teachers admins courses classes enrollments academic_sessions schools).each do |record_type|
27
+ define_method("#{record_type}_endpoint") do
28
+ if endpoint_prefix.nil? || endpoint_prefix == ''
29
+ OneRoster.const_get("#{record_type.upcase}_ENDPOINT")
30
+ else
31
+ OneRoster.const_get("#{record_type.upcase}_ENDPOINT").gsub('ims/oneroster/', "#{endpoint_prefix}")
32
+ end
33
+ end
34
+ end
35
+
25
36
  %i(students teachers classes).each do |record_type|
26
37
  define_method(record_type) do |record_uids = []|
27
38
  authenticate
28
39
 
29
- endpoint = OneRoster.const_get("#{record_type.upcase}_ENDPOINT")
40
+ endpoint = public_send("#{record_type}_endpoint")
30
41
 
31
42
  type = Types.const_get(Dry::Inflector.new.singularize(record_type.to_s.capitalize))
32
43
 
@@ -42,7 +53,7 @@ module OneRoster
42
53
  def admins(record_uids = [])
43
54
  authenticate
44
55
 
45
- records = Paginator.fetch(connection, ADMINS_ENDPOINT, :get, Types::Admin, client: self).force
56
+ records = Paginator.fetch(connection, admins_endpoint, :get, Types::Admin, client: self).force
46
57
 
47
58
  return records if record_uids.empty?
48
59
 
@@ -53,7 +64,7 @@ module OneRoster
53
64
  def schools
54
65
  authenticate
55
66
 
56
- Paginator.fetch(connection, SCHOOLS_ENDPOINT,
67
+ Paginator.fetch(connection, schools_endpoint,
57
68
  :get, Types::School, client: self).force
58
69
  end
59
70
 
@@ -94,7 +105,7 @@ module OneRoster
94
105
  def terms
95
106
  authenticate
96
107
 
97
- endpoint = OneRoster::ACADEMIC_SESSIONS_ENDPOINT
108
+ endpoint = academic_sessions_endpoint
98
109
 
99
110
  type = Types::Term
100
111
 
@@ -108,7 +119,7 @@ module OneRoster
108
119
 
109
120
  courses = Paginator.fetch(
110
121
  connection,
111
- COURSES_ENDPOINT,
122
+ courses_endpoint,
112
123
  :get,
113
124
  Types::Course,
114
125
  client: self
@@ -137,7 +148,7 @@ module OneRoster
137
148
 
138
149
  set_auth_headers(response.raw_body, response.headers['set-cookie'])
139
150
  else
140
- response = connection.execute(TEACHERS_ENDPOINT, :get, limit: 1)
151
+ response = connection.execute(teachers_endpoint, :get, limit: 1)
141
152
 
142
153
  fail ConnectionError, response.raw_body unless response.success?
143
154
  end
@@ -157,7 +168,7 @@ module OneRoster
157
168
  url = token_url || "#{api_url}/token"
158
169
 
159
170
  credential_params = { grant_type: 'client_credentials',
160
- scope: 'https://purl.imsglobal.org/spec/or/v1p1/scope/roster-core.readonly' }
171
+ scope: scope || 'https://purl.imsglobal.org/spec/or/v1p1/scope/roster-core.readonly' }
161
172
 
162
173
  if roster_app == 'infinite_campus'
163
174
  connection.execute(url, :post, credential_params, nil, token_content_type)
@@ -177,7 +188,7 @@ module OneRoster
177
188
  def parse_enrollments(classroom_uids = [])
178
189
  enrollments = Paginator.fetch(
179
190
  connection,
180
- ENROLLMENTS_ENDPOINT,
191
+ enrollments_endpoint,
181
192
  :get,
182
193
  Types::Enrollment,
183
194
  client: self
@@ -63,6 +63,10 @@ module OneRoster
63
63
  request.headers['Content-Type'] = content_type || set_content_type
64
64
  request.headers['Cookie'] = @cookie
65
65
  request.body = render_body(body, content_type)
66
+
67
+ unless @client.service_account.nil?
68
+ request.headers['serviceAccountID'] = @client.service_account
69
+ end
66
70
  end
67
71
  end
68
72
 
@@ -21,7 +21,7 @@ module OneRoster
21
21
  body = response.body
22
22
 
23
23
  fail "Failed to fetch #{@path}" unless response.success?
24
- fail StopIteration if body.empty?
24
+ fail StopIteration if body.nil? || body.empty?
25
25
 
26
26
  if body.any?
27
27
  body.each do |item|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OneRoster
4
- VERSION = '2.3.25'
4
+ VERSION = '2.3.26'
5
5
  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.25
4
+ version: 2.3.26
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-09-05 00:00:00.000000000 Z
11
+ date: 2025-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday