http-client 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +4 -0
- data/lib/http/client.rb +31 -27
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a3c59d32495e536069b73965031e2922f841dd6189c416c0af8b239eda943248
|
4
|
+
data.tar.gz: a8788aa4d96184a07c99b205a1369cdd816d452ed8b677ce1b501e1ef28795f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b334c221d6b0ca938fc02b96f55bcf4cb42c42e3d715c5c4c2dc159a87c9e616b6affb56a041dbcc7f524dd7bf9af1bbf893ad95c841f9d75908461ec74616d0
|
7
|
+
data.tar.gz: 6e7824f573d7838c2ed94ac69703f8b81abe64483013a155b564a205ea0a7614688c772c0da32bdd7a595d7f81dc320eb23730248c81af9c27573010b9a1471c
|
data/CHANGELOG
CHANGED
data/lib/http/client.rb
CHANGED
@@ -9,7 +9,7 @@ require 'zlib'
|
|
9
9
|
|
10
10
|
module HTTP
|
11
11
|
module Client
|
12
|
-
VERSION = '0.6.
|
12
|
+
VERSION = '0.6.1'
|
13
13
|
|
14
14
|
GET = Net::HTTP::Get
|
15
15
|
HEAD = Net::HTTP::Head
|
@@ -326,7 +326,7 @@ module HTTP
|
|
326
326
|
|
327
327
|
def initialize files, query = {}
|
328
328
|
@files = files
|
329
|
-
@query = query
|
329
|
+
@query = query || {}
|
330
330
|
@boundary = generate_boundary
|
331
331
|
end
|
332
332
|
|
@@ -338,34 +338,38 @@ module HTTP
|
|
338
338
|
body = ''.encode('ASCII-8BIT')
|
339
339
|
separator = "--#{boundary}"
|
340
340
|
|
341
|
-
@query
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
341
|
+
if @query && !@query.empty?
|
342
|
+
@query.each do |key, value|
|
343
|
+
body << separator << EOL
|
344
|
+
body << %Q{Content-Disposition: form-data; name="#{key}"} << EOL
|
345
|
+
body << EOL
|
346
|
+
body << value
|
347
|
+
body << EOL
|
348
|
+
end
|
347
349
|
end
|
348
350
|
|
349
|
-
@files
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
351
|
+
if @files && !@files.empty?
|
352
|
+
@files.each do |name, handle|
|
353
|
+
if handle.respond_to?(:read)
|
354
|
+
path = handle.path
|
355
|
+
data = io.read
|
356
|
+
else
|
357
|
+
path = handle
|
358
|
+
data = IO.read(path)
|
359
|
+
end
|
357
360
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
361
|
+
filename = File.basename(path)
|
362
|
+
mime = mime_type(filename)
|
363
|
+
|
364
|
+
body << separator << EOL
|
365
|
+
body << %Q{Content-Disposition: form-data; name="#{name}"; filename="#{filename}"} << EOL
|
366
|
+
body << %Q{Content-Type: #{mime}} << EOL
|
367
|
+
body << %Q{Content-Transfer-Encoding: binary} << EOL
|
368
|
+
body << %Q{Content-Length: #{data.bytesize}} << EOL
|
369
|
+
body << EOL
|
370
|
+
body << data
|
371
|
+
body << EOL
|
372
|
+
end
|
369
373
|
end
|
370
374
|
|
371
375
|
body << separator << "--" << EOL
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bharanee Rathna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -56,20 +56,20 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '12.0'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '12.0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '12.0'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
72
|
+
version: '12.0'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: minitest-reporters
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
|
127
|
-
rubygems_version: 2.5.1
|
126
|
+
rubygems_version: 3.1.1
|
128
127
|
signing_key:
|
129
128
|
specification_version: 4
|
130
129
|
summary: A client wrapper around Net::HTTP
|