strongmind-platform-sdk 3.19.3 → 3.19.5

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: d12cfdf00b2d06fbd2b04dc67e983726521fdbc080bfed5b3109755c6be3ca76
4
- data.tar.gz: '09a83987646e5072760cdb24485c7c8e2bbff1b4bc64bc295d946d0258f96226'
3
+ metadata.gz: 7d308d12a94ac038d5941d6fd082c88fb68e5a7a64e9817c35ff61645e8ee516
4
+ data.tar.gz: '09ce6d8ff5f55dfbdc1f45946fac3af36ff4d08c0da35a65d804eda5d73ac26e'
5
5
  SHA512:
6
- metadata.gz: 7f18fe6e29a925f6859157788b4b3cedec58e6a1efe8786bc467623a6fcc23bd9d86c72d094cb33a647e54ff4d35dcfb64d04aeb8d90caa8bf30acf139b73d12
7
- data.tar.gz: 69d4de88e486e1bc0993e95b8889888e48e4ce4808cf9fa26039258d7ad3949b53221c388fbdff5c6ad7b8ea79ef7f82a4964e0f2e4361d61bdf9c5c488383f3
6
+ metadata.gz: ae1de644a295ad0f7caebb1d5d2eeb7c80c826ec5244afe599d8a63d08966c97fc4a72bac350bf69b1f16ec271edc1af5ab56cd4dc05deb9ebd4091cf868b5ce
7
+ data.tar.gz: 4d420f8df7a06237252e33d6b8d995416beaa06e7a29dd111015d14df45689c4708610dae67edb2d713bcc58f69e47beb3931101b9b0a4cc216b2c16ce05129c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.3)
4
+ strongmind-platform-sdk (3.19.5)
5
5
  activesupport (~> 7.1)
6
6
  aws-sdk-secretsmanager (~> 1.66)
7
7
  faraday (~> 2.5, >= 2.5.2)
data/README.md CHANGED
@@ -115,9 +115,9 @@ class MyModel < ApplicationRecord
115
115
  end
116
116
  ```
117
117
 
118
- For the concern to function, the model must have a `pipeline_noun` class method that returns the noun of the model.
118
+ For the concern to function, the model must have both a `pipeline_noun` and a `pipeline_meta` class method that returns the noun and metadata of the model, respectively.
119
119
 
120
- This can be done once by defining the method in the ApplicationRecord class:
120
+ This can be done once by defining the method(s) in the ApplicationRecord class:
121
121
 
122
122
  ```ruby
123
123
  class ApplicationRecord < ActiveRecord::Base
@@ -126,6 +126,12 @@ class ApplicationRecord < ActiveRecord::Base
126
126
  def self.pipeline_noun
127
127
  "StrongMind.Central.#{name}}"
128
128
  end
129
+
130
+ def self.pipeline_meta
131
+ {
132
+ "source": "strongmind-central"
133
+ }
134
+ end
129
135
  end
130
136
  ```
131
137
 
@@ -138,6 +144,12 @@ class MyModel < ApplicationRecord
138
144
  def self.pipeline_noun
139
145
  "StrongMind.Central.#{name}}"
140
146
  end
147
+
148
+ def self.pipeline_meta
149
+ {
150
+ "source": "strongmind-central"
151
+ }
152
+ end
141
153
  end
142
154
  ```
143
155
 
@@ -16,7 +16,7 @@ module PlatformSdk
16
16
  {
17
17
  "noun": self.class.pipeline_noun,
18
18
  "identifiers": pipeline_identifiers,
19
- "meta": pipeline_meta,
19
+ "meta": self.class.pipeline_meta,
20
20
  "data": pipeline_data(action),
21
21
  "envelope_version": '1.0.0',
22
22
  "message_timestamp": Time.current.utc.iso8601
@@ -27,15 +27,13 @@ module PlatformSdk
27
27
  raise NotImplementedError, 'You must implement the pipeline_noun class method'
28
28
  end
29
29
 
30
- def pipeline_identifiers
31
- {
32
- "id": id
33
- }
30
+ def self.pipeline_meta
31
+ raise NotImplementedError, 'You must implement the pipeline_meta class method, an example value is { "source": "strongmind-central" }'
34
32
  end
35
33
 
36
- def pipeline_meta
34
+ def pipeline_identifiers
37
35
  {
38
- "source": 'strongmind-central'
36
+ "id": id
39
37
  }
40
38
  end
41
39
 
@@ -5,7 +5,7 @@ module PlatformSdk
5
5
  {
6
6
  "noun": described_class.pipeline_noun,
7
7
  "identifiers": { "id": record.id },
8
- "meta": { "source": 'strongmind-central' },
8
+ "meta": described_class.pipeline_meta,
9
9
  "data": data || default_data,
10
10
  "envelope_version": '1.0.0',
11
11
  "message_timestamp": Time.current.utc.iso8601
@@ -16,7 +16,7 @@ module PlatformSdk
16
16
  action:
17
17
  }.merge!(record.attributes.symbolize_keys)
18
18
  end
19
- let(:record) { build(described_class.to_s.downcase.to_sym) }
19
+ let(:record) { build(described_class.to_s.underscore.to_sym) }
20
20
  let(:data_pipeline_client) { double(PlatformSdk::DataPipeline::Client)}
21
21
 
22
22
  before do
@@ -61,8 +61,8 @@ module PlatformSdk
61
61
 
62
62
  def column_to_update(record)
63
63
  [:string, :integer, :boolean].each do |type|
64
- if record.class.columns.select { |c| c.sql_type_metadata.type == type }.any?
65
- return record.class.columns.select { |c| c.sql_type_metadata.type == type }.first.name
64
+ if record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.any?
65
+ return record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.first.name
66
66
  end
67
67
  end
68
68
  end
@@ -25,7 +25,7 @@ module PlatformSdk
25
25
  "message_timestamp": Time.current.utc.iso8601
26
26
  }
27
27
  end
28
- let(:record) { build(described_class.to_s.downcase.to_sym) }
28
+ let(:record) { build(described_class.to_s.underscore.to_sym) }
29
29
  let(:one_roster_common_data) do
30
30
  {
31
31
  "sourcedId": record.roster_id,
@@ -88,8 +88,8 @@ module PlatformSdk
88
88
 
89
89
  def column_to_update(record)
90
90
  %i[string integer boolean].each do |type|
91
- if record.class.columns.select { |c| c.sql_type_metadata.type == type }.any?
92
- return record.class.columns.select { |c| c.sql_type_metadata.type == type }.first.name
91
+ if record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.any?
92
+ return record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.first.name
93
93
  end
94
94
  end
95
95
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "3.19.3"
4
+ VERSION = "3.19.5"
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.3
4
+ version: 3.19.5
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-05-17 00:00:00.000000000 Z
11
+ date: 2024-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday