json_requester 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_requester.rb +8 -5
- 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: a2d4ed52990f4aef4fdf9e2cd0648f005e7470e0b9589f32318c89446e9fbbab
|
4
|
+
data.tar.gz: 2aa352620aa571c8b19dcdf556bba9e89f6ffc5c3c515d772f7bd2b0788a4f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1872fdb58e459b0086a37106bfc654cacd05807a0c81992be6ef8ab51ec58dd938d08698d03216b78918cdf1ecac3ce1fcdb96870670854f3d9895c45d9e7d0e
|
7
|
+
data.tar.gz: 95237fb35a77e6c4d3c7347ebfc1e0ef1435f67adab10a7966549187cda6e1af60562ba91b8fe974dfb2a6dff046af8511916c5dd124c64f547c55b6254b0653
|
data/lib/json_requester.rb
CHANGED
@@ -7,7 +7,6 @@ class JsonRequester
|
|
7
7
|
def initialize(host, multipart: false)
|
8
8
|
@host = host
|
9
9
|
@multipart = multipart
|
10
|
-
@conn = init_conn
|
11
10
|
end
|
12
11
|
|
13
12
|
def http_send(http_method, path, params={}, headers={})
|
@@ -19,7 +18,8 @@ class JsonRequester
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def normal_send(http_method, path, params={}, headers={})
|
22
|
-
|
21
|
+
conn = init_conn
|
22
|
+
res = conn.send(http_method) do |req|
|
23
23
|
req.url path
|
24
24
|
req.headers = headers if object_present?(headers)
|
25
25
|
req.params = params if object_present?(params)
|
@@ -30,7 +30,8 @@ class JsonRequester
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def json_send(http_method, path, params={}, headers={})
|
33
|
-
|
33
|
+
conn = init_conn
|
34
|
+
res = conn.send(http_method) do |req|
|
34
35
|
req.url path
|
35
36
|
req.headers = headers if object_present?(headers)
|
36
37
|
req.headers['Content-Type'] = 'application/json;charset=utf-8'
|
@@ -42,7 +43,8 @@ class JsonRequester
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def form_send(http_method, path, params={}, headers={})
|
45
|
-
|
46
|
+
conn = init_conn
|
47
|
+
res = conn.send(http_method) do |req|
|
46
48
|
req.url path
|
47
49
|
req.headers = headers if object_present?(headers)
|
48
50
|
req.headers['Content-Type'] = 'application/x-www-form-urlencoded ;charset=utf-8'
|
@@ -54,7 +56,8 @@ class JsonRequester
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def multipart_form_send(http_method, path, params={}, headers={})
|
57
|
-
|
59
|
+
conn = init_conn
|
60
|
+
res = conn.send(http_method) do |req|
|
58
61
|
req.url path
|
59
62
|
req.headers = headers if object_present?(headers)
|
60
63
|
req.body = params if object_present?(params)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_requester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JiaRou Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|