turbot-runner 0.0.10 → 0.0.11
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 +8 -8
- data/lib/turbot_runner/version.rb +1 -1
- data/lib/turbot_runner.rb +20 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTEyMjJkMGUzZDg1ODFkZmYzNDM1MzUwMDk0MmY2ZTJiYTQ5OGUyOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTYwYWE1MmUwMjExNjA1ZGU4NzQ4Njg2YjU0NWQ3ODBlZTc0YTZkMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODM5Njk5YTc5YzMyZDFiMmFkZDEzNzczOTVhMjQ4NzUyZWFiYTI2ZDU4ZmU4
|
10
|
+
M2RjM2U0NTMwNzZjMWRiZjRkNjJlMmZmMTEyODM3MzI5NDM5NTQ2YjkzZGZh
|
11
|
+
MWI2NWVlZjQ1ZTRjNmNjMDkxZjBlOTA5N2ZiNmNkYWQyNjMyNzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTlkODMwMjVhNDkwZTgyZTdhMTVhNGYyOGNhNzk5OWIyZTFkNTgwNjZlYjVi
|
14
|
+
N2M4OWEyNTk0NGM0MTNhM2FmYjVkNDc1ZjY4ZWY2M2Q5ZWIzOWE2MmNkZmE2
|
15
|
+
OTg0YzVjNWUzOTE2YjRhZjU1MDA4MDRlNmI3ZmJkYmJkNzMzZTU=
|
data/lib/turbot_runner.rb
CHANGED
@@ -126,7 +126,7 @@ module TurbotRunner
|
|
126
126
|
def validate(record, data_type)
|
127
127
|
schema = get_schema(data_type)
|
128
128
|
errors = JSON::Validator.fully_validate(schema, record, :errors_as_objects => true)
|
129
|
-
errors.map do |error|
|
129
|
+
messages = errors.map do |error|
|
130
130
|
case error[:message]
|
131
131
|
when /The property '#\/' did not contain a required property of '(\w+)'/
|
132
132
|
"Missing required attribute: #{Regexp.last_match(1)}"
|
@@ -134,6 +134,25 @@ module TurbotRunner
|
|
134
134
|
error[:message]
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
if messages.empty?
|
139
|
+
identifying_fields = identifying_fields_for_data_type(data_type)
|
140
|
+
if record.slice(*identifying_fields).empty?
|
141
|
+
messages << ["Missing attributes for identifying fields: #{identifying_fields}"]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
messages
|
146
|
+
end
|
147
|
+
|
148
|
+
def identifying_fields_for_data_type(data_type)
|
149
|
+
if data_type == config['data_type']
|
150
|
+
@config['identifying_fields']
|
151
|
+
else
|
152
|
+
transformers = @config['transformers'].select {|transformer| transformer['data_type'] == data_type}
|
153
|
+
raise "Expected to find precisely 1 transformer matching #{data_type} in manifest.json" unless transformers.size == 1
|
154
|
+
transformers[0]['identifying_fields']
|
155
|
+
end
|
137
156
|
end
|
138
157
|
|
139
158
|
def get_schema(data_type)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbot-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenCorporates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|