topographer 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f03c6ff70ebbd6f7dcb8c6b4d72deb2de304aee0
4
- data.tar.gz: 22c2fd768c6c4d17586b46f0755d4ee56590fe6c
3
+ metadata.gz: 7b6d4fbeb6d8560571f82e6754a9fe3f9f9b8f28
4
+ data.tar.gz: 95008cb652e8f47477da8b9b4801fd7ca6188987
5
5
  SHA512:
6
- metadata.gz: 0c51ad3208acba7412522563cb4d1693c4de97fe30f9e392ca07bddbc3832a050bbb2dd96a8c48313e5025beda6ad50c132c4f310053050d17985c010f884e6b
7
- data.tar.gz: a307fa166260f5dc6e8e44b6099fe5842b4e477bb941922ed0f44f92b8e4fca2c619e2c3d24d861655bca0477fe99ae2fbc372381d85a3b8f13172c9fac062b6
6
+ metadata.gz: 089840b16dc858e75dfe20b2d4422fba137b1a6fbdab8f60c728ca42bb111f6854d97889dac2688ff31f3c3ffb627468925b0c057fe7d6e26f56810734665e77
7
+ data.tar.gz: ee363e886763d4123dc971b1923693c8bef870aecede2338c939e099d1364b0807c7b320fc73cb063c1cafd86d5dfdad21b7852fd30a9be54d463847d2a45fd6
@@ -1,6 +1,12 @@
1
1
  module Topographer
2
2
  class Importer
3
3
  module Logger
4
+ # A log entry from an import. Each row imported produces an entry, regardless of status.
5
+ #
6
+ # @!attribute input_identifier [r]
7
+ # @return [String] the identifier of the input (e.g. the name of the spreadsheet being imported)
8
+ # @!attribute model_name [r]
9
+ # @return [String] the name of the model class being imported for the log entry
4
10
  class LogEntry
5
11
  attr_reader :input_identifier,
6
12
  :model_name
@@ -11,26 +17,32 @@ module Topographer
11
17
  @import_status = import_status
12
18
  end
13
19
 
20
+ # @return [String] the identifier of the input row the entry is for
14
21
  def source_identifier
15
22
  @import_status.input_identifier
16
23
  end
17
24
 
25
+ # @return [String] the message associated with the log entry
18
26
  def message
19
27
  @import_status.message
20
28
  end
21
29
 
30
+ # @return [DateTime] the time that the logged event occurred
22
31
  def timestamp
23
32
  @import_status.timestamp
24
33
  end
25
34
 
35
+ # @return [Hash] a hash of the error details that occurred during the import
26
36
  def details
27
37
  @import_status.errors
28
38
  end
29
39
 
40
+ # @return [Boolean] true if there are no errors
30
41
  def success?
31
42
  !failure?
32
43
  end
33
44
 
45
+ # @return [Boolean] true if there are errors
34
46
  def failure?
35
47
  @import_status.errors?
36
48
  end
@@ -52,10 +52,6 @@ module Topographer
52
52
  if source_data.empty?
53
53
  handle_no_data(mapping_result)
54
54
  else
55
- @validation_mappings.values.each do |validation_field_mapping|
56
- validation_field_mapping.process_input(source_data.data, mapping_result)
57
- end
58
-
59
55
  mappings.each do |_output_field, field_mapping|
60
56
  field_mapping.process_input(source_data.data, mapping_result)
61
57
  end
@@ -34,7 +34,9 @@ module Topographer
34
34
 
35
35
  def validation_field(name, input_columns, &mapping_behavior)
36
36
  validate_unique_validation_name(name)
37
- @validation_mappings[name] = Topographer::Importer::Mapper::ValidationFieldMapping.new(name, input_columns, &mapping_behavior)
37
+ mapping = Topographer::Importer::Mapper::ValidationFieldMapping.new(name, input_columns, &mapping_behavior)
38
+ @validation_mappings[name] = mapping
39
+ @field_mappings[name] = mapping
38
40
  end
39
41
 
40
42
  def default_value(output_field, &mapping_behavior)
@@ -1,3 +1,3 @@
1
1
  module Topographer
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topographer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Simpson