strongmind-platform-sdk 3.19.35 → 3.19.36

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: e7b326eb237f054ac7f37aff6bea73a5a132f28a1f0c243c61797a3845afe409
4
- data.tar.gz: e519fd565cb5d5bb563d626fe188646b69b1f1f4b7b403bbaa94c389ea97010f
3
+ metadata.gz: a06afbab9954bea9a3a155a4088f90347aff9ee86bb833bb73424bb6f3e679d9
4
+ data.tar.gz: 485c42c5319d710f1bdff3bb488a8e7bfa746a0179786037d9398736d129c59c
5
5
  SHA512:
6
- metadata.gz: c53ad285c0ad7931fd5efabb67bbbaa26afe6a30303698c61e606aa7e3dc100d8bb2e2958b47539623563fd974992ea9b1302f8957f84c69edb83a8c16c06231
7
- data.tar.gz: aefa902a5ff106b03419c776e7303d4b18c72496b3728f2931855548a23d2116d4db4e770cbb4f7405b016039ee29be66e9c93a841edf13011c3f60f42593fbd
6
+ metadata.gz: 84b6330f496aa1a05b1445a52de0eb257828b4cc42db271611ecc28ab1faf01b30300a57938095cee0daa089b38b1752fecc6e28a1f1fdbe13111caaaf596094
7
+ data.tar.gz: b9da1277238e4581f5f863009f1dd6740a6b3b738fd0c2ccb679593b9e4345275dc51fe3c285e2651ac2f8b86a39b4dd1b0f5891ffdf58b6f5968b5356aa8994
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.35)
4
+ strongmind-platform-sdk (3.19.36)
5
5
  activesupport (~> 7.1)
6
6
  asset_sync
7
7
  aws-sdk-secretsmanager (~> 1.66)
@@ -423,6 +423,56 @@ module PlatformSdk
423
423
  end
424
424
  end
425
425
 
426
+ # @param course_id [Integer]
427
+ # @param module_id [Integer]
428
+ # @param body [Hash]
429
+ # @option body [String] 'module_item[title]' The name of the module_item and associated content
430
+ # @option body [String] 'module_item[type]' Allowed: ExternalUrl, ExternalTool
431
+ # @option body [Integer] 'module_item[content_id]' The id of the content to link to the module_item. Required
432
+ # @option body [Integer] 'module_item[position]' The position of this item in the module (1-based). Default 0
433
+ # @option body [String] 'module_item[external_url]' External url that the item points to. Required for: ExternalUrl, ExternalTool.
434
+ # @option body [String] 'module_item[completion_requirement][type]' Allowed: must_view, must_contribute, must_submit, must_mark_done.
435
+ def post_module_item(course_id:, module_id:, body:)
436
+ uri = "/api/v1/courses/#{course_id}/modules/#{module_id}/items"
437
+ response = @connection.post(uri) do |req|
438
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
439
+ req.body = body
440
+ end
441
+ handle_rate_limiting response
442
+ result = MultiJson.load response.body, symbolize_keys: true
443
+ if success?(response.status)
444
+ result
445
+ else
446
+ error_messages = String.new
447
+ result[:errors]&.each do |error|
448
+ error_messages << "#{error[:message]} "
449
+ end
450
+ raise "Error creating module item: #{error_messages}"
451
+ end
452
+ end
453
+
454
+ # @param course_id [Integer]
455
+ # @param module_id [Integer]
456
+ # @param module_item_id [Integer]
457
+ def put_publish_module_item(course_id:, module_id:, module_item_id:)
458
+ uri = "/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}"
459
+ response = @connection.put(uri) do |req|
460
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
461
+ req.body = { 'module_item[published]' => true }
462
+ end
463
+ handle_rate_limiting response
464
+ result = MultiJson.load response.body, symbolize_keys: true
465
+ if success?(response.status)
466
+ result
467
+ else
468
+ error_messages = String.new
469
+ result[:errors]&.each do |error|
470
+ error_messages << "#{error[:message]} "
471
+ end
472
+ raise "Error publishing module item: #{error_messages}"
473
+ end
474
+ end
475
+
426
476
  private
427
477
 
428
478
  # @param headers [Faraday::Utils::Headers]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = '3.19.35'
4
+ VERSION = '3.19.36'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.35
4
+ version: 3.19.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team