row_boat 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 3b62eece81abe5efcd17486c08f0e2ba6b654bd9
4
- data.tar.gz: 6d3958463a1c159b07dc00ac3a820334b8189094
3
+ metadata.gz: 35348937cd6f4db06f17a2c28edd13f6597c25c1
4
+ data.tar.gz: e88eddb7470aa700c9f6224bf35ca74d2e945101
5
5
  SHA512:
6
- metadata.gz: de9025837e9acad6c5ae29b838db3a48583a6f258b74e48833788ff6186046d678959513e7e98214b09b723b4d079940f3eec880e7a8cbe36de4323bcf4fd64d
7
- data.tar.gz: 2fb52393859c0e1ec2ce272a6a888fbdaf032afc5a64ab1a2ea93946b3a8176d47e6a238b63a34cdd7435ee2aad5f03a6ca80e8b1aaef444c1529ef493418b50
6
+ metadata.gz: 5ea2b41e6459899550303e8e91e32feb5dc081d4fa98bebd725be0d9ab3bf2aceeec6fc01b9f50695afb987598988d926a0b9875956e05605a4ca9885ff6939e
7
+ data.tar.gz: c5bc5cf77f6fdfc188e725b34b8b8a05ca5131bd138b7c01dc2343f390421ec686b57132043f35a350c44d0af393184730c35194438878958ac17fc425876b17
data/API.md CHANGED
@@ -46,7 +46,7 @@ Imports database records form the given CSV-like object. The CSV-like object can
46
46
  It returns a hash containing
47
47
 
48
48
  - `:invalid_records` - an array of all records that failed to import since they were invalid. If you've configured the `:validate` option to be `false` it will be an empty array.
49
- - `:total_inserted` - the total number of records inserted into the database.
49
+ - `:total_inserts` - the total number of database inserts that were run.
50
50
  - `:inserted_ids` - an array of all of the ids of records inserted into the database.
51
51
  - `:skipped_rows` - every row skipped by returning `nil` from [`preprocess_row`](#preprocess_row).
52
52
 
@@ -262,7 +262,7 @@ Whatever you define in this method will be merged into the defaults:
262
262
 
263
263
  - `:chunk_size` - `500`
264
264
  - `:key_mapping` - `column_mapping`
265
- - `:recursive` - `true`
265
+ - `:recursive` - `false`
266
266
  - `:remove_unmapped_keys` - `true`
267
267
  - `:validate` - `true`
268
268
  - `:value_converters` - `csv_value_converters`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- row_boat (0.4.0)
4
+ row_boat (0.5.0)
5
5
  activerecord (>= 5.0.0)
6
6
  activerecord-import (~> 0.18.2)
7
7
  smarter_csv (~> 1.1)
@@ -141,4 +141,4 @@ DEPENDENCIES
141
141
  yard (~> 0.9.9)
142
142
 
143
143
  BUNDLED WITH
144
- 1.14.6
144
+ 1.15.1
@@ -16,7 +16,7 @@ module RowBoat
16
16
  # @overload import(csv_source)
17
17
  # @param csv_source [String, #read] a CSV-like object that SmarterCSV can read.
18
18
  #
19
- # @return [Hash] a hash with +:invalid_records+, +:total_inserted+, +:inserted_ids+, and +:skipped_rows+.
19
+ # @return [Hash] a hash with +:invalid_records+, +:total_inserts+, +:inserted_ids+, and +:skipped_rows+.
20
20
  #
21
21
  # @see https://github.com/tilo/smarter_csv#documentation SmarterCSV Docs
22
22
  def import(*args, &block)
@@ -40,7 +40,7 @@ module RowBoat
40
40
  # Parses the csv and inserts/updates the database. You probably won't call this method directly,
41
41
  # instead you would call {RowBoat::Base.import}.
42
42
  #
43
- # @return [Hash] a hash with +:invalid_records+, +:total_inserted+, +:inserted_ids+, and +:skipped_rows+.
43
+ # @return [Hash] a hash with +:invalid_records+, +:total_inserts+, +:inserted_ids+, and +:skipped_rows+.
44
44
  def import
45
45
  import_results = []
46
46
 
@@ -156,7 +156,7 @@ module RowBoat
156
156
  def default_options
157
157
  {
158
158
  chunk_size: 500,
159
- recursive: true,
159
+ recursive: false,
160
160
  validate: true,
161
161
  value_converters: csv_value_converters,
162
162
  wrap_in_transaction: true
@@ -305,12 +305,12 @@ module RowBoat
305
305
  def process_import_results(import_results)
306
306
  import_results.each_with_object(
307
307
  invalid_records: [],
308
- total_inserted: 0,
308
+ total_inserts: 0,
309
309
  inserted_ids: [],
310
310
  skipped_rows: skipped_rows
311
311
  ) do |import_result, total_results|
312
312
  total_results[:invalid_records] += import_result.failed_instances
313
- total_results[:total_inserted] += import_result.num_inserts
313
+ total_results[:total_inserts] += import_result.num_inserts
314
314
  total_results[:inserted_ids] += import_result.ids
315
315
  end
316
316
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RowBoat
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: row_boat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Crismali
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-18 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord