abstract_importer 1.7.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/lib/abstract_importer/import_options.rb +1 -0
- data/lib/abstract_importer/strategies/insert_strategy.rb +4 -1
- data/lib/abstract_importer/version.rb +1 -1
- data/test/insert_strategy_test.rb +1 -1
- data/test/upsert_strategy_test.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c34dc2d6f5558255316b38ea0f37d7090e18081a7d86a0af0d0a9a9370e30b5
|
4
|
+
data.tar.gz: ccd295d5ff7fe47394b8629db231ca8933501e9c55bec8af8d303ab7e8e1d384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbeb628bcc04d3f1572721f7c97de4f0a2ec83c0b06ede1c4f61456318ce3da42fe129eecec6edb376ae4bdc656de25e993291ed6c2375788f1f11dc4cdcfb62
|
7
|
+
data.tar.gz: ea4e8446bda13ca443274afb141a0f9c2e965ba010da76cca5dcc3b6a6e480654e109a15d154a3510a94f10f9246adfaf7c65b774f9f7c8ff70f6a0e26c16448
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## v1.9.0 (2023 Mar 8)
|
2
|
+
* Updated to support Ruby version 3.0+
|
3
|
+
|
4
|
+
## v1.8.0 (2021 Dec 10)
|
5
|
+
* Added `prepare_scope` as another callback that can be used when importing a collection
|
6
|
+
|
1
7
|
## v1.7.0 (2021 Nov 19)
|
2
8
|
* Updated to handle `insert_all` and `upsert_all` to `has_many through:` relations in Rails 6.1+
|
3
9
|
|
@@ -58,7 +58,10 @@ module AbstractImporter
|
|
58
58
|
if scope.respond_to?(:proxy_association) && scope.proxy_association.reflection.through_reflection?
|
59
59
|
scope = scope.klass
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
|
+
scope = invoke_callback(:prepare_scope, scope) || scope
|
63
|
+
|
64
|
+
result = scope.public_send(@bulk_operation, batch, **@insert_options)
|
62
65
|
add_batch_to_id_map(result) if remap_ids?
|
63
66
|
end
|
64
67
|
|
@@ -17,7 +17,7 @@ class InsertStrategyTest < ActiveSupport::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
should "import the records in batches" do
|
20
|
-
mock.proxy(Student).insert_all(satisfy { |arg| arg.length == 3 }, anything)
|
20
|
+
mock.proxy(Student).insert_all(satisfy { |arg| arg.length == 3 }, returning: anything)
|
21
21
|
import!
|
22
22
|
assert_equal [456, 457, 458], account.students.pluck(:legacy_id)
|
23
23
|
end
|
@@ -17,7 +17,7 @@ class UpsertStrategyTest < ActiveSupport::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
should "import the records in batches" do
|
20
|
-
mock.proxy(Student).upsert_all(satisfy { |arg| arg.length == 3 }, anything)
|
20
|
+
mock.proxy(Student).upsert_all(satisfy { |arg| arg.length == 3 }, unique_by: anything, returning: anything)
|
21
21
|
import!
|
22
22
|
assert_equal [456, 457, 458], account.students.pluck(:legacy_id)
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstract_importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -206,7 +206,7 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
-
description:
|
209
|
+
description:
|
210
210
|
email:
|
211
211
|
- bob.lail@cph.org
|
212
212
|
executables: []
|
@@ -260,7 +260,7 @@ homepage: https://github.com/cph/abstract_importer
|
|
260
260
|
licenses:
|
261
261
|
- MIT
|
262
262
|
metadata: {}
|
263
|
-
post_install_message:
|
263
|
+
post_install_message:
|
264
264
|
rdoc_options: []
|
265
265
|
require_paths:
|
266
266
|
- lib
|
@@ -275,8 +275,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
275
|
- !ruby/object:Gem::Version
|
276
276
|
version: '0'
|
277
277
|
requirements: []
|
278
|
-
rubygems_version: 3.
|
279
|
-
signing_key:
|
278
|
+
rubygems_version: 3.2.33
|
279
|
+
signing_key:
|
280
280
|
specification_version: 4
|
281
281
|
summary: Provides services for the mass-import of complex relational data
|
282
282
|
test_files:
|