strongmind-platform-sdk 3.26.18 → 3.26.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: e787da55ed9d3e05e9916cd46580af4b19090b38016578cc071e72f51c6e78fb
4
- data.tar.gz: 1be74a7a9e224dc83c1f25edcf220d7d0b85e7881c4c9d8d08d9c58a1261c1e6
3
+ metadata.gz: fe19acc463ab51338600a018634c09307ad3d488fa6af6b93503ead8fb893738
4
+ data.tar.gz: 6d2f80173459c0f0b4df787c05c1471493394366446a186f3cfec11b138219a1
5
5
  SHA512:
6
- metadata.gz: 3111dc1ef21c0881a8e4ddfa62e9dd901f676e073c3ea067c5cf156e11a06551ad137ff158bc44c776c7b753d30265db887fa3cd44534b1300595bf8be9b2dd7
7
- data.tar.gz: 7d40c13fc85a7dacf0a6b91ce01f074c9a18e6b4cc86be7446e8bd2e548c8ede6847d317e846cef3be2f812ef408a3fefc7ff18ed5013ca5f1deec3734aa2afa
6
+ metadata.gz: ced6a264d77d7fb918bb39684a21ff44e67aebfe87a51dee95d0e341d1ae9c958410d431822ce5a896a3fc1f50bc4a81c16d4eedc255b931b4ff9560d37d7d5d
7
+ data.tar.gz: 728fb45330b056137e0d9dddec4805e3fb558985dcfac613562ee865c7a275b33c7ddd579908c073aeb84fdbd6c1b30fe37c1b1c5342cff93ca6b34e61d85ff6
@@ -2,7 +2,7 @@ require 'rails/railtie'
2
2
 
3
3
  module PlatformSdk
4
4
  class AssetSyncInitializer < Rails::Railtie
5
- initializer "platform_sdk.configure_asset_sync" do
5
+ initializer 'platform_sdk.configure_asset_sync' do
6
6
  unless Rails.env.production?
7
7
  AssetSync.configure do |config|
8
8
  config.enabled = false
@@ -12,16 +12,17 @@ module PlatformSdk
12
12
  end
13
13
 
14
14
  AssetSync.configure do |config|
15
- config.fog_provider = "AWS"
16
- config.fog_directory = "strongmind-cdn-prod"
17
- config.fog_region = "us-west-2"
15
+ config.fog_provider = 'AWS'
16
+ config.fog_directory = 'strongmind-cdn-prod'
17
+ config.fog_region = 'us-west-2'
18
18
  config.aws_iam_roles = true
19
19
  end
20
20
 
21
21
  Rails.application.config.active_record.dump_schema_after_migration = false
22
22
 
23
- Rails.application.config.action_controller.asset_host = "//strongmind-cdn-prod.s3.amazonaws.com"
24
- Rails.application.config.action_mailer.asset_host = "//strongmind-cdn-prod.s3.amazonaws.com"
23
+ asset_host = ENV['ASSET_HOST'] || '//strongmind-cdn-prod.s3.amazonaws.com'
24
+ Rails.application.config.action_controller.asset_host = asset_host
25
+ Rails.application.config.action_mailer.asset_host = asset_host
25
26
 
26
27
  Rails.application.config.serve_static_files = true
27
28
  Rails.application.config.assets.compile = true
@@ -471,6 +471,58 @@ module PlatformSdk
471
471
  end
472
472
  end
473
473
 
474
+ # @param course_id [Integer]
475
+ # @param body [Hash]
476
+ # @option body [String] 'module[name]' The name of the module
477
+ # @option body [Integer] 'module[position]' The position of this module in the course (1-based)
478
+ # @return [Hash]
479
+ def create_module(course_id:, body:)
480
+ uri = "/api/v1/courses/#{course_id}/modules"
481
+ response = @connection.post(uri) do |req|
482
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
483
+ req.body = body
484
+ end
485
+ handle_rate_limiting response
486
+ result = MultiJson.load response.body, symbolize_keys: true
487
+ if success?(response.status)
488
+ result
489
+ else
490
+ error_messages = String.new
491
+ result[:errors]&.each do |error|
492
+ error_messages << "#{error[:message]} "
493
+ end
494
+ raise "Error creating module: #{error_messages}"
495
+ end
496
+ end
497
+
498
+ # @param course_id [Integer]
499
+ # @param module_id [Integer]
500
+ # @param body [Hash]
501
+ # @option body [String] 'module[name]' The name of the module
502
+ # @option body [Boolean] 'module[published]' Whether the module is published
503
+ # @option body [String] 'module[unlock_at]' When to unlock the module
504
+ # @option body [Boolean] 'module[require_sequential_progress]' Require sequential progress
505
+ # @option body [Boolean] 'module[publish_final_grade]' Publish final grade
506
+ # @return [Hash]
507
+ def update_module(course_id:, module_id:, body:)
508
+ uri = "/api/v1/courses/#{course_id}/modules/#{module_id}"
509
+ response = @connection.put(uri) do |req|
510
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
511
+ req.body = body
512
+ end
513
+ handle_rate_limiting response
514
+ result = MultiJson.load response.body, symbolize_keys: true
515
+ if success?(response.status)
516
+ result
517
+ else
518
+ error_messages = String.new
519
+ result[:errors]&.each do |error|
520
+ error_messages << "#{error[:message]} "
521
+ end
522
+ raise "Error updating module: #{error_messages}"
523
+ end
524
+ end
525
+
474
526
  # @param course_id [Integer]
475
527
  # @param module_id [Integer]
476
528
  # @param body [Hash]
@@ -3,7 +3,7 @@
3
3
  module PlatformSdk
4
4
  MAJOR = 3
5
5
  MINOR = 26
6
- PATCH = 18
6
+ PATCH = 20
7
7
 
8
8
  VERSION = "#{PlatformSdk::MAJOR}.#{PlatformSdk::MINOR}.#{PlatformSdk::PATCH}"
9
9
  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.26.18
4
+ version: 3.26.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-10 00:00:00.000000000 Z
11
+ date: 2025-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday