topographer 0.0.8 → 0.0.9
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b6d4fbeb6d8560571f82e6754a9fe3f9f9b8f28
|
|
4
|
+
data.tar.gz: 95008cb652e8f47477da8b9b4801fd7ca6188987
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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)
|
data/lib/topographer/version.rb
CHANGED