strongmind-platform-sdk 3.19.8 → 3.19.9

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: a96d5aa7945fd70fc71dc5bca7a00756038727655e4e007a9bfad83a7251b54b
4
- data.tar.gz: de985f9fa3bb6e62c1f2be87b4a9b265d267b03d8635e4010b37725cd9920dbc
3
+ metadata.gz: 3b4e9c7bfc3e7b93b4aabdfa138eaaa574725e36d087df67e15e239a4de595f4
4
+ data.tar.gz: 30acfbe7eb2487768dabe23ff6920b3b95f600e52039cde1f6ab5587cbdccc4e
5
5
  SHA512:
6
- metadata.gz: '07877c3c9e11727ca2ae0712cb7ba783d7ceafe713e2ab916bc7b6c1dd25a8d3b8ba2a047c2007707454e9bacdb3a4df984df6221ee5d3459d132ee5bd25ff73'
7
- data.tar.gz: 1aeefbe7d613d46efc392043ea769567a1da826e7f9aa3abe6dfb5e6d318e10cfe990be636bc87b259dc20737ad4399b5c2fc0bcbc0629b4fee6c2d93ecb826f
6
+ metadata.gz: 7539aa22ff674560101e36c8b668bd43a9d601ddec913865595cd9a8e81d19703b1482b2afd73dd1e44b25183ef1c80fd39701416e8460fd605817fc3676bb36
7
+ data.tar.gz: 1ca026d1104f79143f564c60c9b81473e2794b8501cb161e9df85c17e762ce8c5d5d339757deaecff9e4df623b3e228e2635da9f62779cbb27b7997c10487f0f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.8)
4
+ strongmind-platform-sdk (3.19.9)
5
5
  activesupport (~> 7.1)
6
6
  aws-sdk-secretsmanager (~> 1.66)
7
7
  faraday (~> 2.5, >= 2.5.2)
data/README.md CHANGED
@@ -153,6 +153,25 @@ class MyModel < ApplicationRecord
153
153
  end
154
154
  ```
155
155
 
156
+ You can override the following methods in the model to customize the noun data:
157
+
158
+ ```ruby
159
+ class MyModel < ApplicationRecord
160
+ include PlatformSdk::ActiveRecord::DataPipelineable
161
+
162
+ def pipeline_excluded_attributes
163
+ [:column1, :column2]
164
+ end
165
+
166
+ def pipeline_additional_attributes
167
+ {
168
+ "foo": "important data",
169
+ "bar": "more important data"
170
+ }
171
+ end
172
+ end
173
+ ```
174
+
156
175
  ### Configuration
157
176
  You will need the following ENV variables set in your application to send data to the Data Pipeline (found in bitwarden):
158
177
  * DATA_PIPELINE_HOST
@@ -31,6 +31,10 @@ module PlatformSdk
31
31
  raise NotImplementedError, 'You must implement the pipeline_meta class method, an example value is { "source": "strongmind-central" }'
32
32
  end
33
33
 
34
+ def pipeline_excluded_attributes
35
+ []
36
+ end
37
+
34
38
  def pipeline_identifiers
35
39
  {
36
40
  "id": id
@@ -42,7 +46,7 @@ module PlatformSdk
42
46
 
43
47
  data_hash.merge!(pipeline_additional_attributes)
44
48
 
45
- data_hash
49
+ data_hash.except(*pipeline_excluded_attributes)
46
50
  end
47
51
 
48
52
  def pipeline_additional_attributes
@@ -1,21 +1,24 @@
1
1
  module PlatformSdk
2
2
  module SpecSupport
3
- RSpec.shared_examples "DataPipelineable" do | data = nil|
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
+
4
11
  let(:pipeline_payload) do
5
12
  {
6
13
  "noun": described_class.pipeline_noun,
7
14
  "identifiers": { "id": record.id },
8
15
  "meta": described_class.pipeline_meta,
9
- "data": data || default_data,
16
+ "data": data,
10
17
  "envelope_version": '1.0.0',
11
18
  "message_timestamp": Time.current.utc.iso8601
12
19
  }
13
20
  end
14
- let(:default_data) do
15
- {
16
- action:
17
- }.merge!(record.attributes.symbolize_keys)
18
- end
21
+
19
22
  let(:record) { build(described_class.to_s.underscore.to_sym) }
20
23
  let(:data_pipeline_client) { double(PlatformSdk::DataPipeline::Client)}
21
24
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "3.19.8"
4
+ VERSION = "3.19.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.8
4
+ version: 3.19.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team