table_sync 6.4.0 → 6.4.1
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/lib/table_sync/publishing/batch.rb +3 -0
- data/lib/table_sync/publishing/raw.rb +3 -0
- data/lib/table_sync/utils/required_validator.rb +43 -0
- data/lib/table_sync/utils.rb +1 -0
- data/lib/table_sync/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '04790df8ae9da785364a1ba3d01c7e167183a3c1334257e245eb74fc2894efc4'
|
4
|
+
data.tar.gz: e3fc4d152b0734bf90fc6ec2138aaf155a68563c225b1e00e6167f8595a0f1a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e0559fa23809ca3196ee800c95a29c99f10cd1a96db6a7839e807a4caa3862feb41213c52349cc818a22e5e6e6d926d74d129e7a31bfba7080d5c339dea5789
|
7
|
+
data.tar.gz: a3b259534e55aa2191f90df43257de259f8e31b9187763b9952d09fb3d2fb4cc81b178d6bf3fd6769089cc7adc361420183878b22cc2e95ff2732c6b33598ae9
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [6.4.1] - 2023-08-15
|
5
|
+
### Added
|
6
|
+
- Required fields validation for the Raw and Batch publishers.
|
7
|
+
|
8
|
+
## [6.4.0] - 2023-08-15
|
9
|
+
### Changed
|
10
|
+
- Fix sort in receiving (#79).
|
11
|
+
|
4
12
|
## [6.3.0] - 2023-07-24
|
5
13
|
### Changed
|
6
14
|
- Send all original attributes for `delete` events instead of just PK.
|
data/Gemfile.lock
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
class TableSync::Publishing::Batch
|
4
4
|
include Tainbox
|
5
|
+
include TableSync::Utils::RequiredValidator
|
5
6
|
|
6
7
|
attribute :object_class
|
7
8
|
attribute :original_attributes
|
@@ -11,6 +12,8 @@ class TableSync::Publishing::Batch
|
|
11
12
|
|
12
13
|
attribute :event, default: :update
|
13
14
|
|
15
|
+
require_attributes :object_class, :original_attributes
|
16
|
+
|
14
17
|
def publish_later
|
15
18
|
job.perform_later(job_attributes)
|
16
19
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
class TableSync::Publishing::Raw
|
4
4
|
include Tainbox
|
5
|
+
include TableSync::Utils::RequiredValidator
|
5
6
|
|
6
7
|
attribute :model_name
|
7
8
|
attribute :table_name
|
@@ -13,6 +14,8 @@ class TableSync::Publishing::Raw
|
|
13
14
|
|
14
15
|
attribute :event, default: :update
|
15
16
|
|
17
|
+
require_attributes :model_name, :original_attributes
|
18
|
+
|
16
19
|
def publish_now
|
17
20
|
message.publish
|
18
21
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TableSync::Utils::RequiredValidator
|
4
|
+
module PrependedInitialization
|
5
|
+
def initialize(*)
|
6
|
+
super
|
7
|
+
|
8
|
+
not_filled_attrs = calculate_not_filled_attributes
|
9
|
+
if not_filled_attrs.present?
|
10
|
+
raise(
|
11
|
+
ArgumentError,
|
12
|
+
"Some of required attributes is not provided: #{not_filled_attrs.inspect}",
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module ClassMethods
|
19
|
+
def require_attributes(*attributes)
|
20
|
+
_required_attributes.push(*attributes)
|
21
|
+
end
|
22
|
+
|
23
|
+
def _required_attributes
|
24
|
+
@_required_attributes ||= []
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module InstanceMethods
|
29
|
+
private
|
30
|
+
|
31
|
+
def calculate_not_filled_attributes
|
32
|
+
attributes
|
33
|
+
.select { |key, value| key.in?(self.class._required_attributes) && value.blank? }
|
34
|
+
.keys
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.included(klass)
|
39
|
+
klass.prepend(PrependedInitialization)
|
40
|
+
klass.extend(ClassMethods)
|
41
|
+
klass.include(InstanceMethods)
|
42
|
+
end
|
43
|
+
end
|
data/lib/table_sync/utils.rb
CHANGED
data/lib/table_sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.4.
|
4
|
+
version: 6.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Umbrellio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: memery
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/table_sync/utils/interface_checker.rb
|
128
128
|
- lib/table_sync/utils/proc_array.rb
|
129
129
|
- lib/table_sync/utils/proc_keywords_resolver.rb
|
130
|
+
- lib/table_sync/utils/required_validator.rb
|
130
131
|
- lib/table_sync/version.rb
|
131
132
|
- log/.keep
|
132
133
|
- table_sync.gemspec
|