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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c289298a8de94ccad3a239ed6d05bf33db68c36072015f8bdb2d2a857809bd0f
4
- data.tar.gz: 1f30741dd80b5cabbf9062869260d319c9db647facec1de41fa8921640967600
3
+ metadata.gz: a49714819cab65865ffa979707a867868ac0ce744a2e5dc6c278b29f63b61cb7
4
+ data.tar.gz: 69bdbf4961d01e4f3f83fd5ab56dd24a62da4d24c9cf7ac7633bbcd10d2320dd
5
5
  SHA512:
6
- metadata.gz: ac4f4d7d8906f11ea0840cf416058a665ac2139fd6d3cd0057986624c702e1774fa752c6984ae08c0bc9754c0bfdf9c8fe553635d96ec14cbcc67641e4f95792
7
- data.tar.gz: af893f7320eaa88ff7026f3a2a04e74cface4cd1858db450d6204baa73751b9d6e6c6b743f979319f5e277a7b213ec0ef2989180ae99d1c54921ac07bf2d1817
6
+ metadata.gz: 7e60a28fbcdc39cfa01540bca282de4ad4a2fd4c256c7ef8193b77cfec6aaf62955d741a342b8ba8f68d58bfab714bb54cdfabcfe3c4e9411da52bd5d3f9afbd
7
+ data.tar.gz: 6e8630411c26f55a74d6230f237370e31cc05ca1971d7bf849fc9258b15f03103ba97f952c5ae49ded8bf343c536b7baf39effb1a3f528408e6c14c22a9a1414
@@ -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};#{Base64.encode64(data)}"
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]
@@ -288,8 +288,8 @@ module DataCollector
288
288
  end
289
289
 
290
290
  def to_https(uri, options)
291
-
292
- raise 'TODO'
291
+ input = Input.new
292
+ input.from_uri(uri.to_s, options)
293
293
  end
294
294
 
295
295
  def to_file(uri, options)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module DataCollector
3
- VERSION = "0.44.0"
3
+ VERSION = "0.45.0"
4
4
  end
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.44.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-08 00:00:00.000000000 Z
11
+ date: 2024-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport