strongmind-platform-sdk 3.26.17 → 3.26.18

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: 52b5af739b96508bab2b37ede64e6e33f1167dbe596b9eba7fa3698d6f6b3672
4
- data.tar.gz: 6229e166c700be9c4beba917e03c4f90b9ea4d7f10ea376059905cc99b281341
3
+ metadata.gz: e787da55ed9d3e05e9916cd46580af4b19090b38016578cc071e72f51c6e78fb
4
+ data.tar.gz: 1be74a7a9e224dc83c1f25edcf220d7d0b85e7881c4c9d8d08d9c58a1261c1e6
5
5
  SHA512:
6
- metadata.gz: 9efc5c16b3a0baaf060ebf70f6789076d4880da8bded9282ff000802501638e9fbb0862d3b502f93e79d5aea7329b99de812127e87688bcda7e5483ad0e23d64
7
- data.tar.gz: 381f5e723438486510112bf40c16f87c8f33c6a19edcf4dd7c6e65f5a89594c14ddb89adc99e967be7de91b1455c97f45b8c0140ed757f4fda879497c9703ea2
6
+ metadata.gz: 3111dc1ef21c0881a8e4ddfa62e9dd901f676e073c3ea067c5cf156e11a06551ad137ff158bc44c776c7b753d30265db887fa3cd44534b1300595bf8be9b2dd7
7
+ data.tar.gz: 7d40c13fc85a7dacf0a6b91ce01f074c9a18e6b4cc86be7446e8bd2e548c8ede6847d317e846cef3be2f812ef408a3fefc7ff18ed5013ca5f1deec3734aa2afa
@@ -172,4 +172,3 @@ module PlatformSdk
172
172
  end
173
173
  end
174
174
  end
175
-
@@ -0,0 +1,125 @@
1
+ module PlatformSdk
2
+ module SpecSupport
3
+ RSpec.shared_examples 'DataPipelineableWithoutCallbacks' do |params = {}|
4
+ let(:shared_params) { params }
5
+ let(:frozen_time) { Time.zone.parse('2024-06-09 04:20:00') }
6
+
7
+ # Create a lightweight test record that skips database
8
+ let(:record) do
9
+ rec = described_class.new
10
+ allow(rec).to receive(:save!).and_return(true)
11
+ allow(rec).to receive(:update!).and_return(true)
12
+ allow(rec).to receive(:destroy).and_return(true)
13
+ allow(rec).to receive(:id).and_return(123)
14
+ rec
15
+ end
16
+
17
+ before do
18
+ # Mock job execution
19
+ allow(PlatformSdk::Jobs::SendNounToPipelineJob).to receive(:perform_later)
20
+
21
+ # Mock time
22
+ allow(Time).to receive(:current).and_return(frozen_time)
23
+
24
+ # Default to test environment
25
+ allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('test'))
26
+
27
+ # Skip actual database operations
28
+ allow(described_class).to receive(:create!).and_return(record)
29
+ end
30
+
31
+ context 'create' do
32
+ it 'posts a copy of our data to the data pipeline' do
33
+ record.send_pipeline_create
34
+
35
+ expect(PlatformSdk::Jobs::SendNounToPipelineJob).to have_received(:perform_later).once.with(
36
+ record.pipeline_payload('created'),
37
+ record.one_roster_pipeline_payload
38
+ )
39
+ end
40
+ end
41
+
42
+ context 'destroy' do
43
+ it 'posts a copy of our data to the data pipeline' do
44
+ record.send_pipeline_destroy
45
+
46
+ expect(PlatformSdk::Jobs::SendNounToPipelineJob).to have_received(:perform_later).once.with(
47
+ record.pipeline_payload('destroyed'),
48
+ record.one_roster_pipeline_payload(deleted: true)
49
+ )
50
+ end
51
+
52
+ it 'does not post to the data pipeline if in development environment' do
53
+ allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
54
+
55
+ record.send_pipeline_destroy
56
+
57
+ expect(PlatformSdk::Jobs::SendNounToPipelineJob).not_to have_received(:perform_later)
58
+ end
59
+ end
60
+
61
+ context 'update' do
62
+ context 'after an update' do
63
+ it 'posts a copy of our data to the data pipeline' do
64
+ record.send_pipeline_update
65
+
66
+ expect(PlatformSdk::Jobs::SendNounToPipelineJob).to have_received(:perform_later).once.with(
67
+ record.pipeline_payload('modified'),
68
+ record.one_roster_pipeline_payload
69
+ )
70
+ end
71
+
72
+ it 'does not post to the data pipeline if in development environment' do
73
+ allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
74
+
75
+ record.send_pipeline_update
76
+
77
+ expect(PlatformSdk::Jobs::SendNounToPipelineJob).not_to have_received(:perform_later)
78
+ end
79
+ end
80
+
81
+ context 'after an update that does not change data' do
82
+ it 'does not call send_pipeline_update when saved_changes? is false' do
83
+ # The callback condition `if: -> { saved_changes? }` prevents the method from being called
84
+ allow(record).to receive(:saved_changes?).and_return(false)
85
+
86
+ # This test verifies the callback logic - when there are no changes,
87
+ # the update callback should not trigger send_pipeline_update
88
+ expect(record).not_to receive(:send_pipeline_update)
89
+ end
90
+ end
91
+ end
92
+
93
+ describe '#pipeline_payload' do
94
+ let(:test_attributes) { { 'id' => 123, 'name' => 'Test Name', 'created_at' => frozen_time, 'updated_at' => frozen_time } }
95
+
96
+ before do
97
+ allow(record).to receive(:attributes).and_return(test_attributes)
98
+ end
99
+
100
+ %w[created modified destroyed].each do |action|
101
+ context "when action is #{action}" do
102
+ it 'returns the expected payload structure' do
103
+ payload = record.pipeline_payload(action)
104
+
105
+ expect(payload).to include(
106
+ :noun,
107
+ :identifiers,
108
+ :meta,
109
+ :data,
110
+ :envelope_version,
111
+ :message_timestamp
112
+ )
113
+
114
+ expect(payload[:envelope_version]).to eq('1.0.0')
115
+ expect(payload[:message_timestamp]).to eq(frozen_time.utc.iso8601)
116
+ expect(payload[:identifiers]).to eq(id: 123)
117
+ expect(payload[:data][:action]).to eq(action)
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
125
+
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rspec/core'
4
4
  require 'platform_sdk/spec_support/shared_examples/data_pipelineable_examples'
5
+ require 'platform_sdk/spec_support/shared_examples/data_pipelineable_examples_without_callbacks'
5
6
  require 'platform_sdk/spec_support/shared_examples/one_roster_data_pipelineable_examples'
6
7
 
7
8
  module PlatformSdk
@@ -3,7 +3,7 @@
3
3
  module PlatformSdk
4
4
  MAJOR = 3
5
5
  MINOR = 26
6
- PATCH = 17
6
+ PATCH = 18
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.17
4
+ version: 3.26.18
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-09-30 00:00:00.000000000 Z
11
+ date: 2025-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -299,6 +299,7 @@ files:
299
299
  - lib/platform_sdk/sidekiq/ecs_task_protection_middleware.rb
300
300
  - lib/platform_sdk/spec_support.rb
301
301
  - lib/platform_sdk/spec_support/shared_examples/data_pipelineable_examples.rb
302
+ - lib/platform_sdk/spec_support/shared_examples/data_pipelineable_examples_without_callbacks.rb
302
303
  - lib/platform_sdk/spec_support/shared_examples/one_roster_data_pipelineable_examples.rb
303
304
  - lib/platform_sdk/version.rb
304
305
  - sig/platform_sdk/identity/auth_client.rbs