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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b4e9c7bfc3e7b93b4aabdfa138eaaa574725e36d087df67e15e239a4de595f4
|
4
|
+
data.tar.gz: 30acfbe7eb2487768dabe23ff6920b3b95f600e52039cde1f6ab5587cbdccc4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7539aa22ff674560101e36c8b668bd43a9d601ddec913865595cd9a8e81d19703b1482b2afd73dd1e44b25183ef1c80fd39701416e8460fd605817fc3676bb36
|
7
|
+
data.tar.gz: 1ca026d1104f79143f564c60c9b81473e2794b8501cb161e9df85c17e762ce8c5d5d339757deaecff9e4df623b3e228e2635da9f62779cbb27b7997c10487f0f
|
data/Gemfile.lock
CHANGED
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
|
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
|
16
|
+
"data": data,
|
10
17
|
"envelope_version": '1.0.0',
|
11
18
|
"message_timestamp": Time.current.utc.iso8601
|
12
19
|
}
|
13
20
|
end
|
14
|
-
|
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
|
|
data/lib/platform_sdk/version.rb
CHANGED