data_collector 0.44.0 → 0.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/data_collector/input.rb +11 -6
- data/lib/data_collector/output.rb +2 -2
- data/lib/data_collector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a49714819cab65865ffa979707a867868ac0ce744a2e5dc6c278b29f63b61cb7
|
4
|
+
data.tar.gz: 69bdbf4961d01e4f3f83fd5ab56dd24a62da4d24c9cf7ac7633bbcd10d2320dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e60a28fbcdc39cfa01540bca282de4ad4a2fd4c256c7ef8193b77cfec6aaf62955d741a342b8ba8f68d58bfab714bb54cdfabcfe3c4e9411da52bd5d3f9afbd
|
7
|
+
data.tar.gz: 6e8630411c26f55a74d6230f237370e31cc05ca1971d7bf849fc9258b15f03103ba97f952c5ae49ded8bf343c536b7baf39effb1a3f528408e6c14c22a9a1414
|
data/lib/data_collector/input.rb
CHANGED
@@ -140,6 +140,11 @@ module DataCollector
|
|
140
140
|
http_query_options[:body] = options[:body]
|
141
141
|
|
142
142
|
http_response = http.follow.post(escape_uri(uri), http_query_options)
|
143
|
+
elsif options.key?(:method) && options[:method].downcase.eql?('put')
|
144
|
+
raise DataCollector::InputError, "No body found, a PUT request needs a body" unless options.key?(:body)
|
145
|
+
http_query_options[:body] = options[:body]
|
146
|
+
|
147
|
+
http_response = http.follow.put(escape_uri(uri), http_query_options)
|
143
148
|
else
|
144
149
|
http_response = http.follow.get(escape_uri(uri), http_query_options)
|
145
150
|
end
|
@@ -172,7 +177,7 @@ module DataCollector
|
|
172
177
|
data = html_to_hash(data, options)
|
173
178
|
when 'text/turtle'
|
174
179
|
graph = RDF::Graph.new do |graph|
|
175
|
-
RDF::Turtle::Reader.new(data) {|reader| graph << reader}
|
180
|
+
RDF::Turtle::Reader.new(data) { |reader| graph << reader }
|
176
181
|
end
|
177
182
|
data = JSON.parse(graph.dump(:jsonld, validate: false, standard_prefixes: true))
|
178
183
|
when /^image/
|
@@ -238,9 +243,9 @@ module DataCollector
|
|
238
243
|
data << xml_to_hash(d, options)
|
239
244
|
end
|
240
245
|
end
|
241
|
-
end #block
|
242
|
-
end #entry
|
243
|
-
end #tar
|
246
|
+
end # block
|
247
|
+
end # entry
|
248
|
+
end # tar
|
244
249
|
when '.csv'
|
245
250
|
data = csv_to_hash(data, options)
|
246
251
|
when '.jpg', '.png', '.gif'
|
@@ -267,7 +272,7 @@ module DataCollector
|
|
267
272
|
|
268
273
|
def image_to_data(data, options = {})
|
269
274
|
file_type = options['file_type']
|
270
|
-
"data:#{file_type}
|
275
|
+
"data:#{file_type};base64,#{Base64.encode64(data)}"
|
271
276
|
end
|
272
277
|
|
273
278
|
def xml_to_hash(data, options = {})
|
@@ -290,7 +295,7 @@ module DataCollector
|
|
290
295
|
|
291
296
|
def csv_to_hash(data, options = {})
|
292
297
|
csv_option_keys = options.keys & CSV::DEFAULT_OPTIONS.keys
|
293
|
-
all_cvs_options = {headers: true, header_converters: [:downcase, :symbol]}
|
298
|
+
all_cvs_options = { headers: true, header_converters: [:downcase, :symbol] }
|
294
299
|
|
295
300
|
csv_option_keys.each do |k|
|
296
301
|
all_cvs_options[k] = options[k]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.45.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|