strongmind-platform-sdk 3.19.33 → 3.19.35

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: e802eae6706b8b1575aea870fa85dc1f4d8d230ee76c7c4346168838f669ddfc
4
- data.tar.gz: de43fb4b077de0eb7360f541d3c146f4c53102ac30337bf6591b4b76c7af3a85
3
+ metadata.gz: e7b326eb237f054ac7f37aff6bea73a5a132f28a1f0c243c61797a3845afe409
4
+ data.tar.gz: e519fd565cb5d5bb563d626fe188646b69b1f1f4b7b403bbaa94c389ea97010f
5
5
  SHA512:
6
- metadata.gz: ff125a6616567e8a2f03d66e49ecc90b776d1a38602a6dd233b70722abc63b5abd0d1d834e47dd2dc9890a00cf7f7b6aa27f66b90d68635d8ae5907e41944ff6
7
- data.tar.gz: 80593443c2106b6db3c18792472a8292fe19b3bea3a2a1049ca2377083ff722fe1ac4a621adfc32a01f18807c2b886b22348d9e5f55cdc35da204a9bf848d7ea
6
+ metadata.gz: c53ad285c0ad7931fd5efabb67bbbaa26afe6a30303698c61e606aa7e3dc100d8bb2e2958b47539623563fd974992ea9b1302f8957f84c69edb83a8c16c06231
7
+ data.tar.gz: aefa902a5ff106b03419c776e7303d4b18c72496b3728f2931855548a23d2116d4db4e770cbb4f7405b016039ee29be66e9c93a841edf13011c3f60f42593fbd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.33)
4
+ strongmind-platform-sdk (3.19.35)
5
5
  activesupport (~> 7.1)
6
6
  asset_sync
7
7
  aws-sdk-secretsmanager (~> 1.66)
@@ -8,7 +8,7 @@ module PlatformSdk
8
8
  module CanvasApiWrapper
9
9
  # DataPipeline::Client
10
10
  class Client
11
- attr_reader :host, :token, :connection, :multipart_connection
11
+ attr_reader :host, :token, :connection
12
12
 
13
13
  PAGE_SIZE = 10
14
14
 
@@ -18,10 +18,6 @@ module PlatformSdk
18
18
  @host = "https://#{domain}"
19
19
  @token = token
20
20
  @connection = Faraday.new(url: host, headers: { 'Authorization' => "Bearer #{token}" })
21
- @multipart_connection = Faraday.new(url: host, headers: { 'Authorization' => "Bearer #{token}" }) do |f|
22
- f.request :multipart
23
- f.adapter :net_http
24
- end
25
21
  end
26
22
 
27
23
  # @param course_id [Integer]
@@ -215,8 +211,9 @@ module PlatformSdk
215
211
 
216
212
  # @param course_id [Integer]
217
213
  def course_students(course_id:)
218
- uri = "/api/v1/courses/#{course_id}/students?per_page=#{PAGE_SIZE}"
219
- response = @connection.get(uri)
214
+ uri = "/api/v1/courses/#{course_id}/users?per_page=#{PAGE_SIZE}"
215
+ params = { 'enrollment_type[]' => 'student' }
216
+ response = @connection.get(uri, params)
220
217
  handle_rate_limiting response
221
218
  if success?(response.status)
222
219
  paginated_items headers: response.headers, initial_response: response.body
@@ -230,6 +227,24 @@ module PlatformSdk
230
227
  end
231
228
  end
232
229
 
230
+ # @param course_id [Integer]
231
+ def course_test_student(course_id:)
232
+ uri = "/api/v1/courses/#{course_id}/users"
233
+ params = { 'enrollment_type[]' => 'student_view' }
234
+ response = @connection.get(uri, params)
235
+ handle_rate_limiting response
236
+ if success?(response.status)
237
+ MultiJson.load response.body, symbolize_keys: true
238
+ else
239
+ result = MultiJson.load response.body, symbolize_keys: true
240
+ error_messages = String.new
241
+ result[:errors].each do |error|
242
+ error_messages << "#{error[:message]} "
243
+ end
244
+ raise "Error getting test students: #{error_messages}"
245
+ end
246
+ end
247
+
233
248
  # @param course_id [Integer]
234
249
  def course_users(course_id:)
235
250
  uri = "/api/v1/courses/#{course_id}/users?per_page=#{PAGE_SIZE}"
@@ -391,7 +406,7 @@ module PlatformSdk
391
406
  # @note prerequisite_ids should be a valid module_id, sending and empty array removes all prerequisites.
392
407
  def put_module_prerequesites(course_id:, module_id:, prerequisite_ids:)
393
408
  uri = "/api/v1/courses/#{course_id}/modules/#{module_id}"
394
- response = @multipart_connection.put(uri) do |req|
409
+ response = @connection.put(uri) do |req|
395
410
  req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
396
411
  req.body = { 'module[prerequisite_module_ids]' => prerequisite_ids }
397
412
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = '3.19.33'
4
+ VERSION = '3.19.35'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.33
4
+ version: 3.19.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-09 00:00:00.000000000 Z
11
+ date: 2024-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday