data_collector 0.8.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data_collector.gemspec +28 -28
- data/lib/data_collector/rules_ng.rb +28 -22
- data/lib/data_collector/version.rb +1 -1
- metadata +39 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebd843ffb0d4b94f0f7b627f6320e33a14f425e178edf25ef660bfbbcba008d3
|
4
|
+
data.tar.gz: 5ce7ed06f69033821ee2f5f0ad75e5d0815d05c59d3aa7257189281bb6333053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5010cbdac3aa326f47cc708e40e4cb26da07217951f58e098bfce53632241d976c3addad2c15e66636c8ce4f053824399c078da1a824e4e31612919a49b29383
|
7
|
+
data.tar.gz: 80fba22cfd19d969886135eef8443550c5e3756b25dd072a83c1db71f419b9e9eb061824b6c3bbde7713e98a5d98ebfcf88f8e69908b5143a2ee5f100cdba56a
|
data/data_collector.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require 'data_collector/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'data_collector'
|
8
8
|
spec.version = DataCollector::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Mehmet Celik']
|
10
|
+
spec.email = ['mehmet@celik.be']
|
11
11
|
|
12
12
|
spec.summary = %q{ETL helper library}
|
13
13
|
spec.description = %q{INPUT, FILTER, OUTPUT data with RULES and code}
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
14
|
+
spec.homepage = 'https://github.com/mehmetc/data_collector'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
19
|
if spec.respond_to?(:metadata)
|
20
20
|
#spec.metadata["allowed_push_host"] = "https://github.com/mehmetc/data_collect'"
|
21
21
|
|
22
|
-
spec.metadata[
|
23
|
-
spec.metadata[
|
24
|
-
spec.metadata[
|
22
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
+
spec.metadata['source_code_uri'] = 'https://github.com/mehmetc/data_collect'
|
24
|
+
spec.metadata['changelog_uri'] = 'https://github.com/mehmetc/data_collect'
|
25
25
|
else
|
26
|
-
raise
|
27
|
-
|
26
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
27
|
+
'public gem pushes.'
|
28
28
|
end
|
29
29
|
|
30
30
|
# Specify which files should be added to the gem when it is released.
|
@@ -32,21 +32,21 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
33
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
34
|
end
|
35
|
-
spec.bindir =
|
35
|
+
spec.bindir = 'exe'
|
36
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
-
spec.require_paths = [
|
38
|
-
|
39
|
-
spec.add_runtime_dependency
|
40
|
-
spec.add_runtime_dependency
|
41
|
-
spec.add_runtime_dependency
|
42
|
-
spec.add_runtime_dependency
|
43
|
-
spec.add_runtime_dependency
|
44
|
-
spec.add_runtime_dependency
|
45
|
-
spec.add_runtime_dependency
|
46
|
-
spec.add_runtime_dependency
|
47
|
-
spec.add_runtime_dependency
|
48
|
-
|
49
|
-
spec.add_development_dependency
|
50
|
-
spec.add_development_dependency
|
51
|
-
spec.add_development_dependency
|
37
|
+
spec.require_paths = ['lib']
|
38
|
+
|
39
|
+
spec.add_runtime_dependency 'activesupport', '~> 7.0'
|
40
|
+
spec.add_runtime_dependency 'http', '~> 5.1'
|
41
|
+
spec.add_runtime_dependency 'json', '~> 2.6'
|
42
|
+
spec.add_runtime_dependency 'json-ld', '~> 3.2'
|
43
|
+
spec.add_runtime_dependency 'jsonpath', '~> 1.1'
|
44
|
+
spec.add_runtime_dependency 'mime-types', '~> 3.4'
|
45
|
+
spec.add_runtime_dependency 'minitar', '= 0.9'
|
46
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.13'
|
47
|
+
spec.add_runtime_dependency 'nori', '~> 2.6'
|
48
|
+
|
49
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
50
|
+
spec.add_development_dependency 'minitest', '~> 5.16'
|
51
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
52
52
|
end
|
@@ -18,7 +18,7 @@ module DataCollector
|
|
18
18
|
|
19
19
|
def apply_rule(tag, rule, input_data, output_data, options = {})
|
20
20
|
rule_filter = rule
|
21
|
-
rule_payload =
|
21
|
+
rule_payload = ''
|
22
22
|
|
23
23
|
case rule
|
24
24
|
when Array
|
@@ -28,7 +28,7 @@ module DataCollector
|
|
28
28
|
return output_data
|
29
29
|
when String
|
30
30
|
rule_filter = rule
|
31
|
-
rule_payload =
|
31
|
+
rule_payload = ''
|
32
32
|
else
|
33
33
|
rule_filter = rule.keys.first
|
34
34
|
rule_payload = rule.values.first
|
@@ -40,11 +40,11 @@ module DataCollector
|
|
40
40
|
data = rule_payload
|
41
41
|
else
|
42
42
|
data = rule_payload.select { |s| s.is_a?(String) }
|
43
|
-
rule_payload = rule_payload.
|
44
|
-
rule_payload =
|
43
|
+
rule_payload = rule_payload.reject { |s| s.is_a?(String) }
|
44
|
+
rule_payload = '@' if rule_payload.empty?
|
45
45
|
end
|
46
|
-
when /json_path
|
47
|
-
data = json_path_filter(rule_filter.gsub(/^json_path
|
46
|
+
when /json_path:/
|
47
|
+
data = json_path_filter(rule_filter.gsub(/^json_path:/), input_data)
|
48
48
|
else
|
49
49
|
data = json_path_filter(rule_filter, input_data)
|
50
50
|
end
|
@@ -59,24 +59,27 @@ module DataCollector
|
|
59
59
|
|
60
60
|
def apply_filtered_data_on_payload(input_data, payload, options = {})
|
61
61
|
return nil if input_data.nil?
|
62
|
+
|
62
63
|
output_data = nil
|
63
64
|
case payload.class.name
|
64
65
|
when 'Proc'
|
65
66
|
data = input_data.is_a?(Array) ? input_data : [input_data]
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
output_data = if options.empty?
|
68
|
+
data.map { |d| payload.call(d) }
|
69
|
+
else
|
70
|
+
data.map { |d| payload.call(d, options) }
|
71
|
+
end
|
71
72
|
when 'Hash'
|
72
73
|
input_data = [input_data] unless input_data.is_a?(Array)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
if input_data.is_a?(Array)
|
75
|
+
output_data = input_data.map do |m|
|
76
|
+
if payload.key?('suffix')
|
77
|
+
"#{m}#{payload['suffix']}"
|
78
|
+
else
|
79
|
+
payload[m]
|
80
|
+
end
|
78
81
|
end
|
79
|
-
end
|
82
|
+
end
|
80
83
|
when 'Array'
|
81
84
|
output_data = input_data
|
82
85
|
payload.each do |p|
|
@@ -87,8 +90,12 @@ module DataCollector
|
|
87
90
|
end
|
88
91
|
|
89
92
|
output_data.compact! if output_data.is_a?(Array)
|
90
|
-
output_data.flatten! if output_data.is_a?(Array)
|
91
|
-
|
93
|
+
output_data.flatten! if output_data.is_a?(Array)
|
94
|
+
if output_data.is_a?(Array) &&
|
95
|
+
output_data.size == 1 &&
|
96
|
+
(output_data.first.is_a?(Array) || output_data.first.is_a?(Hash))
|
97
|
+
output_data = output_data.first
|
98
|
+
end
|
92
99
|
|
93
100
|
output_data
|
94
101
|
end
|
@@ -97,9 +104,8 @@ module DataCollector
|
|
97
104
|
data = nil
|
98
105
|
return data if input_data.nil? || input_data.empty?
|
99
106
|
return input_data if input_data.is_a?(String)
|
100
|
-
Core::filter(input_data, filter)
|
101
|
-
end
|
102
|
-
|
103
107
|
|
108
|
+
Core.filter(input_data, filter)
|
109
|
+
end
|
104
110
|
end
|
105
111
|
end
|
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '7.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: http
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.6'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: json-ld
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2
|
61
|
+
version: '3.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2
|
68
|
+
version: '3.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: jsonpath
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: mime-types
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.4'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.4'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitar
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,75 +109,75 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.9'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: nokogiri
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '1.13'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '1.13'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: nori
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '2.6'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '2.6'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: bundler
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '2.
|
145
|
+
version: '2.3'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '2.
|
152
|
+
version: '2.3'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: minitest
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '5.16'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
166
|
+
version: '5.16'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: rake
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '13.0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '13.0'
|
181
181
|
description: INPUT, FILTER, OUTPUT data with RULES and code
|
182
182
|
email:
|
183
183
|
- mehmet@celik.be
|
@@ -211,7 +211,7 @@ metadata:
|
|
211
211
|
homepage_uri: https://github.com/mehmetc/data_collector
|
212
212
|
source_code_uri: https://github.com/mehmetc/data_collect
|
213
213
|
changelog_uri: https://github.com/mehmetc/data_collect
|
214
|
-
post_install_message:
|
214
|
+
post_install_message:
|
215
215
|
rdoc_options: []
|
216
216
|
require_paths:
|
217
217
|
- lib
|
@@ -226,8 +226,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
-
signing_key:
|
229
|
+
rubygems_version: 3.1.4
|
230
|
+
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: ETL helper library
|
233
233
|
test_files: []
|