strongmind-platform-sdk 3.19.11 → 3.19.13

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: 105565e923a6f95b4b8b3dbb43a48507a48572a38b312afacf5389bf2ebf0813
4
- data.tar.gz: 5661390d896cdda5a7951c2f9df6fd6e0c0d1acbef283065bd8bf73f10c712e7
3
+ metadata.gz: e7c3c712c2fc562f84a6c9c689aff656811166a69fd465c8c7be28fc5f74b9de
4
+ data.tar.gz: c4ee9b6c0a9431888b896be1a10e16784a484a73581d5df3d55a6cfc1a981319
5
5
  SHA512:
6
- metadata.gz: b5b27c608e8fbc340067b91a5d5330e62141ceb013ac5c9ba1bd9d500d7137a9b00967c16cfdedccdac81d4d93a2a82accab0a574064016c8e0ac801042e4500
7
- data.tar.gz: d2d016785f019cfc3a4f17325bf4aff392cab308fde3ddbae23c371ddeedf06ad8871eeffaad1a5d0cbaffeb3859644deba55e3b3a52b8ec3fc13c80747fd072
6
+ metadata.gz: 7283e747a0e4bdb2b91cefe583fa871b4d3a232a4898b4b1e63f1764b0c692da2cf102302963afd4b3b12c536a84e9a3ec25968165464f1d2aeb5f92f88cc0dd
7
+ data.tar.gz: 3951f91be2df18a8ac2fcf8f18699df96516cb78beae5fb21547383a2ffa19561bd88121abd621b9490a7ee29b537d40cbb863d52849e40a793b77b49576c337
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.11)
4
+ strongmind-platform-sdk (3.19.13)
5
5
  activesupport (~> 7.1)
6
6
  aws-sdk-secretsmanager (~> 1.66)
7
7
  faraday (~> 2.5, >= 2.5.2)
@@ -95,7 +95,7 @@ GEM
95
95
  public_suffix (>= 2.0.2, < 6.0)
96
96
  ast (2.4.2)
97
97
  aws-eventstream (1.3.0)
98
- aws-partitions (1.936.0)
98
+ aws-partitions (1.937.0)
99
99
  aws-sdk-cloudwatch (1.91.0)
100
100
  aws-sdk-core (~> 3, >= 3.193.0)
101
101
  aws-sigv4 (~> 1.1)
@@ -45,8 +45,12 @@ module PlatformSdk
45
45
  data_hash = { action: }.merge!(attributes.symbolize_keys)
46
46
 
47
47
  data_hash.merge!(pipeline_additional_attributes)
48
+ Rails.logger.info("Data Hash after merge of additional attrs: #{data_hash}")
48
49
 
49
- data_hash.except(*pipeline_excluded_attributes)
50
+ data_hash = data_hash.except(*pipeline_excluded_attributes)
51
+
52
+ Rails.logger.info("Data Pipeline Payload: #{data_hash}")
53
+ data_hash
50
54
  end
51
55
 
52
56
  def pipeline_additional_attributes
@@ -64,9 +68,17 @@ module PlatformSdk
64
68
  pipeline_password: ENV.fetch('DATA_PIPELINE_PASSWORD', '')
65
69
  }
66
70
  client = PlatformSdk::DataPipeline::Client.new(credentials)
67
- client.post(pipeline_payload(action)) unless Rails.env.development?
71
+
72
+ begin
73
+ client.post(pipeline_payload(action)) unless Rails.env.development?
74
+ rescue => e
75
+ Rails.logger.info("Error posting to data pipeline: #{e.message}")
76
+ end
77
+
68
78
  return unless respond_to?(:one_roster_data_type) && !Rails.env.development?
69
79
 
80
+ Rails.logger.info('POSTING TO ONE ROSTER...')
81
+
70
82
  client.post(one_roster_pipeline_payload(deleted: action == "destroyed"))
71
83
  end
72
84
  end
@@ -273,14 +273,7 @@ module PlatformSdk
273
273
  if success?(response.status)
274
274
  MultiJson.load response.body, symbolize_keys: true
275
275
  else
276
- result = MultiJson.load response.body, symbolize_keys: true
277
- message = 'Error creating quiz submission'
278
- if response.status == 403
279
- raise "#{message}: #{result[:message]}"
280
- end
281
- if result[:errors]
282
- raise parse_response_errors message:, result:
283
- end
276
+ handle_post_response_errors(response, 'Error creating quiz submission')
284
277
  end
285
278
  end
286
279
 
@@ -300,14 +293,7 @@ module PlatformSdk
300
293
  if success?(response.status)
301
294
  MultiJson.load response.body, symbolize_keys: true
302
295
  else
303
- result = MultiJson.load response.body, symbolize_keys: true
304
- message = 'Error completing quiz submission'
305
- if response.status == 403
306
- raise "#{message}: #{result[:message]}"
307
- end
308
- if result[:errors]
309
- raise parse_response_errors message:, result:
310
- end
296
+ handle_post_response_errors(response, 'Error completing quiz submission')
311
297
  end
312
298
  end
313
299
 
@@ -323,14 +309,23 @@ module PlatformSdk
323
309
  if success?(response.status)
324
310
  MultiJson.load response.body, symbolize_keys: true
325
311
  else
326
- result = MultiJson.load response.body, symbolize_keys: true
327
- message = 'Error marking module items read'
328
- if response.status == 403
329
- raise "#{message}: #{result[:message]}"
330
- end
331
- if result[:errors]
332
- raise parse_response_errors message:, result:
333
- end
312
+ handle_post_response_errors(response, 'Error marking module items read')
313
+ end
314
+ end
315
+
316
+ # @param course_id [Integer]
317
+ # @param module_id [Integer]
318
+ # @param module_item_id [Integer]
319
+ # @param user_id [Integer]
320
+ # @return nil
321
+ def post_mark_module_item_done(course_id:, module_id:, module_item_id:, user_id:)
322
+ uri = "api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}/done?as_user_id=#{user_id}"
323
+ response = @connection.post(uri)
324
+ handle_rate_limiting response
325
+ if success?(response.status)
326
+ MultiJson.load response.body, symbolize_keys: true
327
+ else
328
+ handle_post_response_errors(response, 'Error marking module item done')
334
329
  end
335
330
  end
336
331
 
@@ -408,6 +403,15 @@ module PlatformSdk
408
403
  sleep_time = [reset_time - Time.now.to_i, 0].max + 1
409
404
  sleep(sleep_time)
410
405
  end
406
+
407
+ # @param response [Faraday::Response]
408
+ # @param message [String]
409
+ def handle_post_response_errors(response, message)
410
+ result = MultiJson.load response.body, symbolize_keys: true
411
+ raise "#{message}: #{result[:message]}" if response.status == 403
412
+ raise parse_response_errors(message:, result:) if result[:errors]
413
+
414
+ end
411
415
  end
412
416
  end
413
417
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "3.19.11"
4
+ VERSION = "3.19.13"
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.11
4
+ version: 3.19.13
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-05-30 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday