strongmind-platform-sdk 3.19.27 → 3.19.28

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: fb238507ca4a9bda09f14bf05de01a72f00309593098b2edf9ab10e64a7f98eb
4
+ data.tar.gz: 3e2ff07b9a83e68f6dc8a02f087507efda3820c51318342f80b6f9e4878180cb
5
5
  SHA512:
6
- metadata.gz: ea51d2be6f48e614563c7df44adc4ecdad60485cb6971099588d0cd733a2c42c008465643cbb7ce59a3b2ea71a3bf0b6451a6bea2f5e9361f7c222fd9336ec55
7
- data.tar.gz: 5da47de65e652f9ecf6da3d51fe3c0278338bc6d4c1b386c41d177eb72f04e47f53a22cbd41ea6bb2c6f03de303cf83510b0be00d8ffc0d609f2096e5059a402
6
+ metadata.gz: 3f861788db41a15d59d4e557b5e84534765d040f76abaae1f7b60db81628eabf264a2e05634a0e5a9c75ca2c32ace7a92c3aecfee59346befff842826fc2c623
7
+ data.tar.gz: 9c6feb6436d5feb5b2288bfec00253e7aecc91caa131a85fa93c4eaba899ffb9a042cd902be95252e3a21e623f96649c98846baf307fa33db54d4519da0fc1fc
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.28)
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.961.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)
@@ -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,34 @@ 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
+ let(:data) do
91
+ { action: }
92
+ .merge(record.attributes.symbolize_keys)
93
+ .merge(record.pipeline_additional_attributes)
94
+ .except(*record.pipeline_excluded_attributes)
95
+ end
96
+ it 'returns the expected payload' do
97
+ expect(record.pipeline_payload(action)).to eq(pipeline_payload)
98
+ end
99
+ end
100
+ end
101
+ end
92
102
  end
93
103
  end
94
104
  end
105
+
@@ -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.28'
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.28
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-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday