table_sync 6.0.4 → 6.3.0

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: c48d862b8330d868a174505278c8a49003bf7538c27385f5dab5698758066081
4
- data.tar.gz: 20069f9959c72c74e1df331c41cc641ba5ea864413580624a99ccacd0334915d
3
+ metadata.gz: 251f53271dc85250b7440f317c7d88821164059da4f98dda2c1a1bb529e3e8cb
4
+ data.tar.gz: 3f413e11ebe4a980813740be902df63cd59cb38191164a96183efa92c96cb83b
5
5
  SHA512:
6
- metadata.gz: 0fd5d6406e00b91cf5f89fa16fa4d507b47fa7abdb801d1697a1607b3f97891947164dcfa73c516514b8fb42b3832717b4410753697f6857b59588a927d07d45
7
- data.tar.gz: 4e42062c80868f36a8b49b2e2d1c3c3ee6cb630aafaced024382f7d079a3bcd8afc17c6668bcf8dc9cd188f86e54d168b125c88d29906cfbc52c2982d011a63c
6
+ metadata.gz: a430b17c569d1df6cd0cff7fd2f6c1786871b7a1fdd5e7ed8803ca7201c98f5db6e46169510d3010bac0c65d1838375c5d44c5824ebf3a5686db5e6c4b262a0b
7
+ data.tar.gz: '0758e052599d7d049a9a44e29d5b48f2bc2e8915c49849638cb57757ac90e88f736ad03ed57354fc3092243c5f7b4f91f673c42a5e09db4795507a1f0c429871'
@@ -30,7 +30,7 @@ jobs:
30
30
  strategy:
31
31
  fail-fast: false
32
32
  matrix:
33
- ruby: ["2.5", "2.6", "2.7", "3.0"]
33
+ ruby: ["2.7", "3.0", "3.1"]
34
34
 
35
35
  name: ${{ matrix.ruby }}
36
36
 
@@ -47,6 +47,6 @@ jobs:
47
47
  - run: bundle exec rubocop
48
48
  - run: bundle exec rspec
49
49
 
50
- - uses: coverallsapp/github-action@v1.1.2
50
+ - uses: coverallsapp/github-action@master
51
51
  with:
52
52
  github-token: ${{ secrets.GITHUB_TOKEN }}
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_gem:
2
2
  rubocop-config-umbrellio: lib/rubocop.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.5
5
+ TargetRubyVersion: 2.7
6
6
  Include:
7
7
  - bin/*
8
8
  - lib/**/*.rb
@@ -35,3 +35,14 @@ Lint/MissingSuper:
35
35
 
36
36
  Style/MissingRespondToMissing:
37
37
  Enabled: false
38
+
39
+ Style/HashConversion:
40
+ Exclude:
41
+ - spec/**/*
42
+
43
+ Style/OpenStructUse:
44
+ Exclude:
45
+ - spec/**/*
46
+
47
+ RSpec/PendingWithoutReason:
48
+ Enabled: false # Many false positives
data/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [6.3.0] - 2023-07-24
5
+ ### Changed
6
+ - Send all original attributes for `delete` events instead of just PK.
7
+
8
+ ## [6.2.0] - 2023-06-29
9
+ ### Changed
10
+ - `rabbit_messaging` gem version is locked on `~> 0.13` in order to provide a way to keep "up-to-date"
11
+ the actual rabbit_messaging gem version on our projects with table_sync update;
12
+
13
+ ## [6.1.0] - 2022-11-24
14
+ ### Changed
15
+
16
+ - Instead of using `object_class` for `TableSync::Publishing::Raw`, use `model_name`,
17
+ which accepts `String` instead of `Class`.
18
+ - Can manually disable notifications by setting `TableSync.notify = false`.
19
+ - `TableSync::Publishing::Raw` accepts two additional optional arguments: `table_name` and `schema`,
20
+ this attributes only used to fill information for the notification.
21
+
4
22
  ## [6.0.4] - 2022-02-05
5
23
  ### Fixed
6
24
 
data/Gemfile.lock CHANGED
@@ -1,219 +1,240 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_sync (6.0.4)
4
+ table_sync (6.3.0)
5
5
  memery
6
- rabbit_messaging
6
+ rabbit_messaging (~> 0.13)
7
7
  rails
8
8
  self_data
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (6.1.4.4)
14
- actionpack (= 6.1.4.4)
15
- activesupport (= 6.1.4.4)
13
+ actioncable (7.0.5.1)
14
+ actionpack (= 7.0.5.1)
15
+ activesupport (= 7.0.5.1)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailbox (6.1.4.4)
19
- actionpack (= 6.1.4.4)
20
- activejob (= 6.1.4.4)
21
- activerecord (= 6.1.4.4)
22
- activestorage (= 6.1.4.4)
23
- activesupport (= 6.1.4.4)
18
+ actionmailbox (7.0.5.1)
19
+ actionpack (= 7.0.5.1)
20
+ activejob (= 7.0.5.1)
21
+ activerecord (= 7.0.5.1)
22
+ activestorage (= 7.0.5.1)
23
+ activesupport (= 7.0.5.1)
24
24
  mail (>= 2.7.1)
25
- actionmailer (6.1.4.4)
26
- actionpack (= 6.1.4.4)
27
- actionview (= 6.1.4.4)
28
- activejob (= 6.1.4.4)
29
- activesupport (= 6.1.4.4)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.0.5.1)
29
+ actionpack (= 7.0.5.1)
30
+ actionview (= 7.0.5.1)
31
+ activejob (= 7.0.5.1)
32
+ activesupport (= 7.0.5.1)
30
33
  mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
31
37
  rails-dom-testing (~> 2.0)
32
- actionpack (6.1.4.4)
33
- actionview (= 6.1.4.4)
34
- activesupport (= 6.1.4.4)
35
- rack (~> 2.0, >= 2.0.9)
38
+ actionpack (7.0.5.1)
39
+ actionview (= 7.0.5.1)
40
+ activesupport (= 7.0.5.1)
41
+ rack (~> 2.0, >= 2.2.4)
36
42
  rack-test (>= 0.6.3)
37
43
  rails-dom-testing (~> 2.0)
38
44
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
39
- actiontext (6.1.4.4)
40
- actionpack (= 6.1.4.4)
41
- activerecord (= 6.1.4.4)
42
- activestorage (= 6.1.4.4)
43
- activesupport (= 6.1.4.4)
45
+ actiontext (7.0.5.1)
46
+ actionpack (= 7.0.5.1)
47
+ activerecord (= 7.0.5.1)
48
+ activestorage (= 7.0.5.1)
49
+ activesupport (= 7.0.5.1)
50
+ globalid (>= 0.6.0)
44
51
  nokogiri (>= 1.8.5)
45
- actionview (6.1.4.4)
46
- activesupport (= 6.1.4.4)
52
+ actionview (7.0.5.1)
53
+ activesupport (= 7.0.5.1)
47
54
  builder (~> 3.1)
48
55
  erubi (~> 1.4)
49
56
  rails-dom-testing (~> 2.0)
50
57
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
- activejob (6.1.4.4)
52
- activesupport (= 6.1.4.4)
58
+ activejob (7.0.5.1)
59
+ activesupport (= 7.0.5.1)
53
60
  globalid (>= 0.3.6)
54
- activemodel (6.1.4.4)
55
- activesupport (= 6.1.4.4)
56
- activerecord (6.1.4.4)
57
- activemodel (= 6.1.4.4)
58
- activesupport (= 6.1.4.4)
59
- activestorage (6.1.4.4)
60
- actionpack (= 6.1.4.4)
61
- activejob (= 6.1.4.4)
62
- activerecord (= 6.1.4.4)
63
- activesupport (= 6.1.4.4)
64
- marcel (~> 1.0.0)
61
+ activemodel (7.0.5.1)
62
+ activesupport (= 7.0.5.1)
63
+ activerecord (7.0.5.1)
64
+ activemodel (= 7.0.5.1)
65
+ activesupport (= 7.0.5.1)
66
+ activestorage (7.0.5.1)
67
+ actionpack (= 7.0.5.1)
68
+ activejob (= 7.0.5.1)
69
+ activerecord (= 7.0.5.1)
70
+ activesupport (= 7.0.5.1)
71
+ marcel (~> 1.0)
65
72
  mini_mime (>= 1.1.0)
66
- activesupport (6.1.4.4)
73
+ activesupport (7.0.5.1)
67
74
  concurrent-ruby (~> 1.0, >= 1.0.2)
68
75
  i18n (>= 1.6, < 2)
69
76
  minitest (>= 5.1)
70
77
  tzinfo (~> 2.0)
71
- zeitwerk (~> 2.3)
72
78
  amq-protocol (2.3.2)
73
79
  ast (2.4.2)
74
80
  builder (3.2.4)
75
- bundler-audit (0.8.0)
81
+ bundler-audit (0.9.1)
76
82
  bundler (>= 1.2.0, < 3)
77
83
  thor (~> 1.0)
78
- bunny (2.19.0)
84
+ bunny (2.20.3)
79
85
  amq-protocol (~> 2.3, >= 2.3.1)
80
86
  sorted_set (~> 1, >= 1.0.2)
81
87
  coderay (1.1.3)
82
- concurrent-ruby (1.1.9)
88
+ concurrent-ruby (1.2.2)
83
89
  crass (1.0.6)
84
- diff-lcs (1.4.4)
85
- docile (1.3.5)
86
- erubi (1.10.0)
87
- globalid (1.0.0)
90
+ date (3.3.3)
91
+ diff-lcs (1.5.0)
92
+ docile (1.4.0)
93
+ erubi (1.12.0)
94
+ globalid (1.1.0)
88
95
  activesupport (>= 5.0)
89
- i18n (1.9.1)
96
+ i18n (1.14.1)
90
97
  concurrent-ruby (~> 1.0)
91
- lamian (1.5.0)
98
+ json (2.6.3)
99
+ lamian (1.7.0)
92
100
  rails (>= 4.2)
93
- loofah (2.13.0)
101
+ loofah (2.21.3)
94
102
  crass (~> 1.0.2)
95
- nokogiri (>= 1.5.9)
96
- mail (2.7.1)
103
+ nokogiri (>= 1.12.0)
104
+ mail (2.8.1)
97
105
  mini_mime (>= 0.1.1)
106
+ net-imap
107
+ net-pop
108
+ net-smtp
98
109
  marcel (1.0.2)
99
110
  memery (1.4.1)
100
111
  ruby2_keywords (~> 0.0.2)
101
112
  method_source (1.0.0)
102
113
  mini_mime (1.1.2)
103
- mini_portile2 (2.6.1)
104
- minitest (5.15.0)
105
- nio4r (2.5.8)
106
- nokogiri (1.12.5)
107
- mini_portile2 (~> 2.6.1)
114
+ mini_portile2 (2.8.2)
115
+ minitest (5.18.1)
116
+ net-imap (0.3.6)
117
+ date
118
+ net-protocol
119
+ net-pop (0.1.2)
120
+ net-protocol
121
+ net-protocol (0.2.1)
122
+ timeout
123
+ net-smtp (0.3.3)
124
+ net-protocol
125
+ nio4r (2.5.9)
126
+ nokogiri (1.15.2)
127
+ mini_portile2 (~> 2.8.2)
108
128
  racc (~> 1.4)
109
- parallel (1.20.1)
110
- parser (3.0.0.0)
129
+ parallel (1.22.1)
130
+ parser (3.2.1.0)
111
131
  ast (~> 2.4.1)
112
- pg (1.2.3)
113
- pry (0.14.0)
132
+ pg (1.4.5)
133
+ pry (0.14.2)
114
134
  coderay (~> 1.1)
115
135
  method_source (~> 1.0)
116
- rabbit_messaging (0.12.1)
136
+ rabbit_messaging (0.13.0)
117
137
  bunny (~> 2.0)
118
138
  lamian
119
139
  rails (>= 5.2)
120
140
  sneakers (~> 2.0)
121
141
  tainbox
122
- racc (1.6.0)
123
- rack (2.2.3)
124
- rack-test (1.1.0)
125
- rack (>= 1.0, < 3)
126
- rails (6.1.4.4)
127
- actioncable (= 6.1.4.4)
128
- actionmailbox (= 6.1.4.4)
129
- actionmailer (= 6.1.4.4)
130
- actionpack (= 6.1.4.4)
131
- actiontext (= 6.1.4.4)
132
- actionview (= 6.1.4.4)
133
- activejob (= 6.1.4.4)
134
- activemodel (= 6.1.4.4)
135
- activerecord (= 6.1.4.4)
136
- activestorage (= 6.1.4.4)
137
- activesupport (= 6.1.4.4)
142
+ racc (1.7.1)
143
+ rack (2.2.7)
144
+ rack-test (2.1.0)
145
+ rack (>= 1.3)
146
+ rails (7.0.5.1)
147
+ actioncable (= 7.0.5.1)
148
+ actionmailbox (= 7.0.5.1)
149
+ actionmailer (= 7.0.5.1)
150
+ actionpack (= 7.0.5.1)
151
+ actiontext (= 7.0.5.1)
152
+ actionview (= 7.0.5.1)
153
+ activejob (= 7.0.5.1)
154
+ activemodel (= 7.0.5.1)
155
+ activerecord (= 7.0.5.1)
156
+ activestorage (= 7.0.5.1)
157
+ activesupport (= 7.0.5.1)
138
158
  bundler (>= 1.15.0)
139
- railties (= 6.1.4.4)
140
- sprockets-rails (>= 2.0.0)
159
+ railties (= 7.0.5.1)
141
160
  rails-dom-testing (2.0.3)
142
161
  activesupport (>= 4.2.0)
143
162
  nokogiri (>= 1.6)
144
- rails-html-sanitizer (1.4.2)
145
- loofah (~> 2.3)
146
- railties (6.1.4.4)
147
- actionpack (= 6.1.4.4)
148
- activesupport (= 6.1.4.4)
163
+ rails-html-sanitizer (1.6.0)
164
+ loofah (~> 2.21)
165
+ nokogiri (~> 1.14)
166
+ railties (7.0.5.1)
167
+ actionpack (= 7.0.5.1)
168
+ activesupport (= 7.0.5.1)
149
169
  method_source
150
- rake (>= 0.13)
170
+ rake (>= 12.2)
151
171
  thor (~> 1.0)
152
- rainbow (3.0.0)
172
+ zeitwerk (~> 2.5)
173
+ rainbow (3.1.1)
153
174
  rake (13.0.6)
154
- rbtree (0.4.5)
155
- regexp_parser (2.1.1)
175
+ rbtree (0.4.6)
176
+ regexp_parser (2.7.0)
156
177
  rexml (3.2.5)
157
- rspec (3.10.0)
158
- rspec-core (~> 3.10.0)
159
- rspec-expectations (~> 3.10.0)
160
- rspec-mocks (~> 3.10.0)
161
- rspec-core (3.10.1)
162
- rspec-support (~> 3.10.0)
163
- rspec-expectations (3.10.1)
178
+ rspec (3.12.0)
179
+ rspec-core (~> 3.12.0)
180
+ rspec-expectations (~> 3.12.0)
181
+ rspec-mocks (~> 3.12.0)
182
+ rspec-core (3.12.1)
183
+ rspec-support (~> 3.12.0)
184
+ rspec-expectations (3.12.2)
164
185
  diff-lcs (>= 1.2.0, < 2.0)
165
- rspec-support (~> 3.10.0)
166
- rspec-mocks (3.10.2)
186
+ rspec-support (~> 3.12.0)
187
+ rspec-mocks (3.12.3)
167
188
  diff-lcs (>= 1.2.0, < 2.0)
168
- rspec-support (~> 3.10.0)
169
- rspec-support (3.10.2)
170
- rubocop (1.11.0)
189
+ rspec-support (~> 3.12.0)
190
+ rspec-support (3.12.0)
191
+ rubocop (1.43.0)
192
+ json (~> 2.3)
171
193
  parallel (~> 1.10)
172
- parser (>= 3.0.0.0)
194
+ parser (>= 3.2.0.0)
173
195
  rainbow (>= 2.2.2, < 4.0)
174
196
  regexp_parser (>= 1.8, < 3.0)
175
- rexml
176
- rubocop-ast (>= 1.2.0, < 2.0)
197
+ rexml (>= 3.2.5, < 4.0)
198
+ rubocop-ast (>= 1.24.1, < 2.0)
177
199
  ruby-progressbar (~> 1.7)
178
- unicode-display_width (>= 1.4.0, < 3.0)
179
- rubocop-ast (1.4.1)
180
- parser (>= 2.7.1.5)
181
- rubocop-config-umbrellio (1.11.0.40)
182
- rubocop (= 1.11.0)
183
- rubocop-performance (= 1.10.0)
184
- rubocop-rails (= 2.9.1)
185
- rubocop-rake (= 0.5.1)
186
- rubocop-rspec (= 2.2.0)
187
- rubocop-sequel (= 0.2.0)
188
- rubocop-performance (1.10.0)
189
- rubocop (>= 0.90.0, < 2.0)
200
+ unicode-display_width (>= 2.4.0, < 3.0)
201
+ rubocop-ast (1.26.0)
202
+ parser (>= 3.2.1.0)
203
+ rubocop-config-umbrellio (1.43.0.81)
204
+ rubocop (~> 1.43.0)
205
+ rubocop-performance (~> 1.15.0)
206
+ rubocop-rails (~> 2.17.0)
207
+ rubocop-rake (~> 0.6.0)
208
+ rubocop-rspec (~> 2.16.0)
209
+ rubocop-sequel (~> 0.3.3)
210
+ rubocop-performance (1.15.2)
211
+ rubocop (>= 1.7.0, < 2.0)
190
212
  rubocop-ast (>= 0.4.0)
191
- rubocop-rails (2.9.1)
213
+ rubocop-rails (2.17.4)
192
214
  activesupport (>= 4.2.0)
193
215
  rack (>= 1.1)
194
- rubocop (>= 0.90.0, < 2.0)
195
- rubocop-rake (0.5.1)
196
- rubocop
197
- rubocop-rspec (2.2.0)
216
+ rubocop (>= 1.33.0, < 2.0)
217
+ rubocop-rake (0.6.0)
198
218
  rubocop (~> 1.0)
199
- rubocop-ast (>= 1.1.0)
200
- rubocop-sequel (0.2.0)
219
+ rubocop-rspec (2.16.0)
220
+ rubocop (~> 1.33)
221
+ rubocop-sequel (0.3.4)
201
222
  rubocop (~> 1.0)
202
223
  ruby-progressbar (1.11.0)
203
224
  ruby2_keywords (0.0.5)
204
- self_data (1.2.1)
205
- sequel (5.43.0)
225
+ self_data (1.3.0)
226
+ sequel (5.65.0)
206
227
  serverengine (2.0.7)
207
228
  sigdump (~> 0.2.2)
208
- set (1.0.2)
229
+ set (1.0.3)
209
230
  sigdump (0.2.4)
210
- simplecov (0.21.2)
231
+ simplecov (0.22.0)
211
232
  docile (~> 1.1)
212
233
  simplecov-html (~> 0.11)
213
234
  simplecov_json_formatter (~> 0.1)
214
235
  simplecov-html (0.12.3)
215
236
  simplecov-lcov (0.8.0)
216
- simplecov_json_formatter (0.1.2)
237
+ simplecov_json_formatter (0.1.4)
217
238
  sneakers (2.11.0)
218
239
  bunny (~> 2.12)
219
240
  concurrent-ruby (~> 1.0)
@@ -223,24 +244,18 @@ GEM
223
244
  sorted_set (1.0.3)
224
245
  rbtree
225
246
  set (~> 1.0)
226
- sprockets (4.0.2)
227
- concurrent-ruby (~> 1.0)
228
- rack (> 1, < 3)
229
- sprockets-rails (3.4.2)
230
- actionpack (>= 5.2)
231
- activesupport (>= 5.2)
232
- sprockets (>= 3.0.0)
233
247
  tainbox (2.1.2)
234
248
  activesupport
235
- thor (1.2.1)
236
- timecop (0.9.4)
237
- tzinfo (2.0.4)
249
+ thor (1.2.2)
250
+ timecop (0.9.6)
251
+ timeout (0.4.0)
252
+ tzinfo (2.0.6)
238
253
  concurrent-ruby (~> 1.0)
239
- unicode-display_width (2.0.0)
254
+ unicode-display_width (2.4.2)
240
255
  websocket-driver (0.7.5)
241
256
  websocket-extensions (>= 0.1.0)
242
257
  websocket-extensions (0.1.5)
243
- zeitwerk (2.5.4)
258
+ zeitwerk (2.6.8)
244
259
 
245
260
  PLATFORMS
246
261
  ruby
@@ -262,4 +277,4 @@ DEPENDENCIES
262
277
  timecop
263
278
 
264
279
  BUNDLED WITH
265
- 2.2.27
280
+ 2.4.6
data/README.md CHANGED
@@ -20,13 +20,7 @@ require 'table_sync'
20
20
 
21
21
  ## Usage
22
22
 
23
- - [Message protocol](docs/message_protocol.md)
24
- - [Publishing](docs/publishing.md)
25
- - [Publishers](docs/publishing/publishers.md)
26
- - [Configuration](docs/publishing/configuration.md)
27
- - [Manual Sync (examples)](docs/publishing/manual.md)
28
- - [Receiving](docs/receiving.md)
29
- - [Notifications](docs/notifications.md)
23
+ Usage information available in the [Wiki](https://github.com/umbrellio/table_sync/wiki).
30
24
 
31
25
  ## Contributing
32
26
 
@@ -4,6 +4,7 @@ module TableSync
4
4
  Error = Class.new(StandardError)
5
5
 
6
6
  NoObjectsForSyncError = Class.new(Error)
7
+ InvalidConfig = Class.new(Error)
7
8
 
8
9
  class EventError < Error
9
10
  def initialize(event)
@@ -61,9 +62,9 @@ module TableSync
61
62
 
62
63
  case type
63
64
  when :req
64
- #:nocov:
65
+ # :nocov:
65
66
  name.to_s
66
- #:nocov:
67
+ # :nocov:
67
68
  when :keyreq
68
69
  "#{name}:"
69
70
  when :block
@@ -1,9 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSync::Instrument
4
- module_function
4
+ NOTIFIER_REQUIRED_ARGS = %i[table schema event count direction].freeze
5
+
6
+ extend self
5
7
 
6
8
  def notify(**args)
7
- TableSync.notifier&.notify(**args)
9
+ return unless TableSync.notify?
10
+ raise(TableSync::InvalidConfig, error_message) if TableSync.notifier.nil?
11
+ validate_args!(**args)
12
+
13
+ TableSync.notifier.notify(**args)
14
+ end
15
+
16
+ private
17
+
18
+ def error_message
19
+ <<~MSG.squish
20
+ Notifications are enabled, but no notifier is set in the config.
21
+ Need to setup notifier by specifying TableSync#notifier setting.
22
+ MSG
23
+ end
24
+
25
+ def validate_args!(**args)
26
+ missing_keywords = NOTIFIER_REQUIRED_ARGS - args.compact.keys
27
+ return if missing_keywords.blank?
28
+
29
+ raise ArgumentError, "Missing keywords: #{missing_keywords.join(', ')}."
8
30
  end
9
31
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module TableSync::ORMAdapter
4
4
  class ActiveRecord < Base
5
+ def self.model_naming(object_class)
6
+ TableSync::NamingResolver::ActiveRecord.new(table_name: object_class.table_name)
7
+ end
8
+
5
9
  def find
6
10
  @object = object_class.find_by(needle)
7
11
 
@@ -17,9 +21,5 @@ module TableSync::ORMAdapter
17
21
  def attributes
18
22
  object.attributes.symbolize_keys
19
23
  end
20
-
21
- def self.model_naming(object_class)
22
- TableSync::NamingResolver::ActiveRecord.new(table_name: object_class.table_name)
23
- end
24
24
  end
25
25
  end
@@ -4,6 +4,12 @@ module TableSync::ORMAdapter
4
4
  class Base
5
5
  attr_reader :object, :object_class, :object_data
6
6
 
7
+ # :nocov:
8
+ def self.model_naming
9
+ raise NotImplementedError
10
+ end
11
+ # :nocov:
12
+
7
13
  def initialize(object_class, object_data)
8
14
  @object_class = object_class
9
15
  @object_data = object_data.symbolize_keys
@@ -47,7 +53,7 @@ module TableSync::ORMAdapter
47
53
  if object.respond_to?(:attributes_for_destroy)
48
54
  object.attributes_for_destroy
49
55
  else
50
- needle
56
+ attributes
51
57
  end
52
58
  end
53
59
 
@@ -83,10 +89,6 @@ module TableSync::ORMAdapter
83
89
  def attributes
84
90
  raise NotImplementedError
85
91
  end
86
-
87
- def self.model_naming
88
- raise NotImplementedError
89
- end
90
92
  # :nocov:
91
93
  end
92
94
  end
@@ -2,6 +2,12 @@
2
2
 
3
3
  module TableSync::ORMAdapter
4
4
  class Sequel < Base
5
+ def self.model_naming(object_class)
6
+ TableSync::NamingResolver::Sequel.new(
7
+ table_name: object_class.table_name, db: object_class.db,
8
+ )
9
+ end
10
+
5
11
  def attributes
6
12
  object.values
7
13
  end
@@ -19,11 +25,5 @@ module TableSync::ORMAdapter
19
25
 
20
26
  super
21
27
  end
22
-
23
- def self.model_naming(object_class)
24
- TableSync::NamingResolver::Sequel.new(
25
- table_name: object_class.table_name, db: object_class.db,
26
- )
27
- end
28
28
  end
29
29
  end
@@ -2,24 +2,28 @@
2
2
 
3
3
  module TableSync::Publishing::Data
4
4
  class Raw
5
- attr_reader :object_class, :attributes_for_sync, :event
5
+ attr_reader :model_name, :attributes_for_sync, :event
6
6
 
7
- def initialize(object_class:, attributes_for_sync:, event:)
8
- @object_class = object_class
7
+ def initialize(model_name:, attributes_for_sync:, event:)
8
+ @model_name = model_name
9
9
  @attributes_for_sync = attributes_for_sync
10
10
  @event = TableSync::Event.new(event)
11
11
  end
12
12
 
13
13
  def construct
14
14
  {
15
- model: object_class,
16
- attributes: attributes_for_sync,
15
+ model: model_name,
16
+ attributes: wrapped_attributes_for_sync,
17
17
  version: version,
18
18
  event: event.resolve,
19
19
  metadata: event.metadata,
20
20
  }
21
21
  end
22
22
 
23
+ def wrapped_attributes_for_sync
24
+ attributes_for_sync.is_a?(Array) ? attributes_for_sync : [attributes_for_sync]
25
+ end
26
+
23
27
  def version
24
28
  Time.current.to_f
25
29
  end