strongmind-platform-sdk 3.19.27 → 3.19.29

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: 38a836fe864379fbd489563114f6a20817c25ffb6b13dc3d1dd35022fa02601a
4
- data.tar.gz: 16dc3688eaf7216dfdbe51ec93a939a778d6e2d5330eed76587b2d4fcc27e9c4
3
+ metadata.gz: 320e36c7dd55685d757865b29fa004be3f60f97e7bd808b60f27c9eb2ef49d56
4
+ data.tar.gz: 2c2f7a47508a7c10668607a51944a72024fcade8e45450611232e27cc0de1e4b
5
5
  SHA512:
6
- metadata.gz: ea51d2be6f48e614563c7df44adc4ecdad60485cb6971099588d0cd733a2c42c008465643cbb7ce59a3b2ea71a3bf0b6451a6bea2f5e9361f7c222fd9336ec55
7
- data.tar.gz: 5da47de65e652f9ecf6da3d51fe3c0278338bc6d4c1b386c41d177eb72f04e47f53a22cbd41ea6bb2c6f03de303cf83510b0be00d8ffc0d609f2096e5059a402
6
+ metadata.gz: a759953660daf91ade1193a4e58b4fa6bc69ed5af634c99a0c1b0364af7d863822a0ed0c28c90070b6891d49d7029bb546b2caad4b5625ef6eb376f7b409d367
7
+ data.tar.gz: e424a0ac570c46672851ae57a61f5e7230d86182f83944fca59829eedc4b92c67625e54b6d0bc5c7ea8a16eaea90223564f5c4fc7b130b328a80013c70923286
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.27)
4
+ strongmind-platform-sdk (3.19.29)
5
5
  activesupport (~> 7.1)
6
6
  asset_sync
7
7
  aws-sdk-secretsmanager (~> 1.66)
@@ -103,8 +103,8 @@ GEM
103
103
  unf
104
104
  ast (2.4.2)
105
105
  aws-eventstream (1.3.0)
106
- aws-partitions (1.960.0)
107
- aws-sdk-cloudwatch (1.96.0)
106
+ aws-partitions (1.962.0)
107
+ aws-sdk-cloudwatch (1.97.0)
108
108
  aws-sdk-core (~> 3, >= 3.201.0)
109
109
  aws-sigv4 (~> 1.5)
110
110
  aws-sdk-core (3.201.3)
@@ -152,7 +152,7 @@ GEM
152
152
  fog-core (~> 2.1)
153
153
  fog-json (~> 1.1)
154
154
  fog-xml (~> 0.1)
155
- fog-core (2.4.0)
155
+ fog-core (2.5.0)
156
156
  builder
157
157
  excon (~> 0.71)
158
158
  formatador (>= 0.2, < 2.0)
@@ -192,7 +192,7 @@ GEM
192
192
  method_source (1.1.0)
193
193
  mime-types (3.5.2)
194
194
  mime-types-data (~> 3.2015)
195
- mime-types-data (3.2024.0702)
195
+ mime-types-data (3.2024.0806)
196
196
  mini_mime (1.1.5)
197
197
  mini_portile2 (2.8.7)
198
198
  minitest (5.24.1)
@@ -54,11 +54,10 @@ module PlatformSdk
54
54
  end
55
55
 
56
56
  def pipeline_data(action)
57
- data_hash = { action: }.merge!(attributes.symbolize_keys)
58
-
59
- data_hash.merge!(pipeline_additional_attributes)
60
-
61
- data_hash.except(*pipeline_excluded_attributes)
57
+ attributes.symbolize_keys
58
+ .merge(pipeline_additional_attributes)
59
+ .except(*pipeline_excluded_attributes)
60
+ .merge(action:)
62
61
  end
63
62
 
64
63
  def pipeline_additional_attributes
@@ -1,24 +1,6 @@
1
1
  module PlatformSdk
2
2
  module SpecSupport
3
3
  RSpec.shared_examples "DataPipelineable" do
4
- let(:data) do
5
- { action: }
6
- .merge(record.attributes.symbolize_keys)
7
- .merge(record.pipeline_additional_attributes)
8
- .except(*record.pipeline_excluded_attributes)
9
- end
10
-
11
- let(:pipeline_payload) do
12
- {
13
- "noun": described_class.pipeline_noun,
14
- "identifiers": { "id": record.id },
15
- "meta": described_class.pipeline_meta,
16
- "data": data,
17
- "envelope_version": '1.0.0',
18
- "message_timestamp": Time.current.utc.iso8601
19
- }
20
- end
21
-
22
4
  let(:record) { build(described_class.to_s.underscore.to_sym) }
23
5
  let(:data_pipeline_client) { double(PlatformSdk::DataPipeline::Client) }
24
6
 
@@ -28,34 +10,35 @@ module PlatformSdk
28
10
  Timecop.freeze(DateTime.parse('2024-06-09 04:20:00'))
29
11
  end
30
12
 
31
- after do
32
- Timecop.return
33
- end
13
+ after { Timecop.return }
34
14
 
35
15
  context 'after_create callbacks' do
36
- let(:action) { 'created' }
16
+ before { allow(record).to receive(:send_pipeline_create) }
37
17
 
38
18
  it "defines an after_create callback" do
39
19
  record.save!
40
- expect(data_pipeline_client).to have_received(:post).with(pipeline_payload)
20
+ expect(record).to have_received(:send_pipeline_create)
41
21
  end
42
22
  end
43
23
 
44
24
  context 'before_destroy callbacks' do
45
- let(:action) { 'destroyed' }
25
+ before do
26
+ allow(record).to receive(:send_pipeline_create)
27
+ allow(record).to receive(:send_pipeline_destroy)
28
+ end
46
29
 
47
30
  it "defines an after_destroy callback" do
48
31
  record.save!
49
32
  record.destroy
50
- expect(data_pipeline_client).to have_received(:post).with(pipeline_payload)
33
+
34
+ expect(record).to have_received(:send_pipeline_create)
35
+ expect(record).to have_received(:send_pipeline_destroy)
51
36
  end
52
37
  end
53
38
 
54
39
  context 'after_update callbacks' do
55
- let(:action) { 'modified' }
56
-
57
40
  before do
58
- allow(record).to receive(:send_pipeline_create)
41
+ allow(record).to receive(:send_pipeline_update)
59
42
  record.save!
60
43
  end
61
44
 
@@ -63,13 +46,13 @@ module PlatformSdk
63
46
  column = column_to_update(record)
64
47
  unless column.nil?
65
48
  update_record(record, column)
66
- expect(data_pipeline_client).to have_received(:post).with(pipeline_payload)
49
+ expect(record).to have_received(:send_pipeline_update)
67
50
  end
68
51
  end
69
52
  end
70
53
 
71
54
  def column_to_update(record)
72
- [:string, :integer, :boolean].each do |type|
55
+ %i[string integer boolean].each do |type|
73
56
  columns_to_update = record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/(_id|_type)$/) && c.name != 'id' }
74
57
  return columns_to_update.first.name if columns_to_update.any?
75
58
  end
@@ -89,6 +72,36 @@ module PlatformSdk
89
72
  record.update!(column => new_record[column])
90
73
  end
91
74
  end
75
+
76
+ describe '#pipeline_payload' do
77
+ %w[created modified destroyed].each do |action|
78
+ context "when action is #{action}" do
79
+ let(:action) { action }
80
+ let(:pipeline_payload) do
81
+ {
82
+ "noun": described_class.pipeline_noun,
83
+ "identifiers": { "id": record.id },
84
+ "meta": described_class.pipeline_meta,
85
+ "data": data,
86
+ "envelope_version": '1.0.0',
87
+ "message_timestamp": Time.current.utc.iso8601
88
+ }
89
+ end
90
+
91
+ let(:data) do
92
+ record.attributes.symbolize_keys
93
+ .merge(record.pipeline_additional_attributes)
94
+ .except(*record.pipeline_excluded_attributes)
95
+ .merge(action:)
96
+ end
97
+
98
+ it 'returns the expected payload' do
99
+ expect(record.pipeline_payload(action)).to eq(pipeline_payload)
100
+ end
101
+ end
102
+ end
103
+ end
92
104
  end
93
105
  end
94
106
  end
107
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = '3.19.27'
4
+ VERSION = '3.19.29'
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.27
4
+ version: 3.19.29
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-07-31 00:00:00.000000000 Z
11
+ date: 2024-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday