abstract_importer 1.3.3 → 1.3.4

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: e3c6b8d26de8bab191b1284a03f2bc563f394b17
4
- data.tar.gz: a9ae38851ed8554c95cf4d8265283f2a5d141832
3
+ metadata.gz: 51e786a9666c22acd429d7f492d0cc84744cd222
4
+ data.tar.gz: feea5423d323820bd47c5b701c11187b88d3ff94
5
5
  SHA512:
6
- metadata.gz: 8c25ef8ea38b675426863a7299835c05a5a46dd124dd08d39453b66a81f9e3338d2706e3f41c18056926f2e44a32af1c23d5c3d2164de512d1aedc4ea581e35e
7
- data.tar.gz: e4b471c39b1f775219efab5d9767e2fef4855a0d783526e991b9165e8e0e3ca4659f042268c7e6da3b8c191ef1569fa217b86e0427b4f653c4a143b90ac04091
6
+ metadata.gz: 0840d9026d26c679f66e8f038d00480f77d3d6228ead03b25dd905fd855387121ba30db9036239cd77ac8a83d8933087976afcd265d7f192404da210099d97d3
7
+ data.tar.gz: 63bdb142056eefdf38eb3585d98fdce6b7c009286c10d8c81cafc1b2fccc4e185ab3fd41b462d84714626396e242293d44978c3ce634846e6621478aac6447f0
data/.travis.yml CHANGED
@@ -2,9 +2,13 @@
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.1.2
5
+
6
+ # https://github.com/travis-ci/travis-ci/issues/5239
5
7
  before_install:
8
+ - gem update bundler
6
9
  - sudo apt-add-repository -y ppa:travis-ci/sqlite3
7
10
  - sudo apt-get -y update
8
11
  - sudo apt-get install sqlite3=3.7.15.1-1~travis1
12
+
9
13
  script:
10
14
  - bundle exec rake test
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # AbstractImporter
2
2
 
3
- [![Build Status](https://travis-ci.org/concordia-publishing-house/abstract_importer.png?branch=master)](https://travis-ci.org/concordia-publishing-house/abstract_importer)
4
- [![Code Climate](https://codeclimate.com/github/concordia-publishing-house/abstract_importer.png)](https://codeclimate.com/github/concordia-publishing-house/abstract_importer)
3
+ [![Gem Version](https://badge.fury.io/rb/abstract_importer.svg)](https://rubygems.org/gems/abstract_importer)
4
+ [![Code Climate](https://codeclimate.com/github/cph/abstract_importer.svg)](https://codeclimate.com/github/cph/abstract_importer)
5
+ [![Build Status](https://travis-ci.org/cph/abstract_importer.svg)](https://travis-ci.org/cph/abstract_importer)
5
6
 
6
7
  AbstractImporter provides services for importing complex data from an arbitrary data source. It:
7
8
 
@@ -97,7 +97,7 @@ module AbstractImporter
97
97
  Proc.new do |attrs|
98
98
  if attrs.key?(foreign_key) && attrs.key?(foreign_type)
99
99
  foreign_model = attrs[foreign_type]
100
- depends_on = foreign_model.tableize.to_sym if foreign_model
100
+ depends_on = foreign_model.constantize.table_name.to_sym if foreign_model
101
101
  attrs[foreign_key] = depends_on && map_foreign_key(attrs[foreign_key], name, foreign_key, depends_on)
102
102
  else
103
103
  reporter.count_notice "#{name}.#{foreign_key} will not be mapped because it is not used"
@@ -50,9 +50,9 @@ module AbstractImporter
50
50
 
51
51
 
52
52
  def record_failed(record, hash)
53
- error_messages = invalid_params[record.class.name] ||= {}
53
+ error_messages = invalid_params[record.class.name] ||= Hash.new { |hash, key| hash[key] = [] }
54
54
  record.errors.full_messages.each do |error_message|
55
- error_messages[error_message] = hash unless error_messages.key?(error_message)
55
+ error_messages[error_message].push hash
56
56
  count_error(error_message)
57
57
  end
58
58
  end
@@ -89,11 +89,17 @@ module AbstractImporter
89
89
 
90
90
  def print_invalid_params
91
91
  return if invalid_params.empty?
92
- status "\n\n\n#{("="*80)}\nExamples of invalid hashes\n#{("="*80)}"
92
+ status "\n\n\n#{("="*80)}\nInvalid records\n#{("="*80)}"
93
93
  invalid_params.each do |model_name, errors|
94
94
  status "\n\n--#{model_name}#{("-"*(78 - model_name.length))}"
95
- errors.each do |error_message, hash|
96
- status "\n #{error_message}:\n #{hash.inspect}"
95
+ errors.each do |error_message, hashes|
96
+ status "\n #{error_message}:"
97
+ hashes.each do |hash|
98
+ status "\n"
99
+ hash.each do |key, value|
100
+ status " #{key.inspect}\t#{value.inspect}"
101
+ end
102
+ end
97
103
  end
98
104
  end
99
105
  end
@@ -1,3 +1,3 @@
1
1
  module AbstractImporter
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  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.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  version: '0'
256
256
  requirements: []
257
257
  rubyforge_project:
258
- rubygems_version: 2.4.8
258
+ rubygems_version: 2.2.2
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: Provides services for the mass-import of complex relational data