kis_http 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kis_http.rb +2 -2
- data/lib/kis_http/headers.rb +3 -3
- data/lib/kis_http/options.rb +3 -3
- data/lib/kis_http/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: b80b04fc1a30b28254ba7384c15f0e43e1418258dd454d1656af827ba1060d38
|
4
|
+
data.tar.gz: c5288db7382fea7daeef6e2cb1a7a346dc65e9e2d49ae76754ec6820418cbd3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e65794f80de0468f452b52f393351f179acdd471ff34ab3db1d301a037e6e0a73af69fa251515c76bfaa074fbda9813c1dde0254d26d08c8275a1e988ec47d30
|
7
|
+
data.tar.gz: f6db9a4864bfe140d2bde6a858cbcc85fcf3af4f6808459f21e69055caf4a3a826edde46f4a3ea3633dc5ed2cfa9b3048b478670ed975d5aa0b4cdec2f9c384c
|
data/lib/kis_http.rb
CHANGED
@@ -29,13 +29,13 @@ module KisHttp
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def request(url, body: nil, headers: nil, options: nil)
|
32
|
-
options =
|
32
|
+
options = KisHttp.Options(options) if options
|
33
33
|
|
34
34
|
uri = URI("#{url}#{options}")
|
35
35
|
|
36
36
|
request = yield uri.request_uri
|
37
37
|
|
38
|
-
|
38
|
+
KisHttp.Headers(headers).assign_each_to(request) if headers
|
39
39
|
|
40
40
|
request.body = body ? JSON.generate(body) : ''
|
41
41
|
|
data/lib/kis_http/headers.rb
CHANGED
@@ -70,12 +70,12 @@ module KisHttp
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def self.Headers(obj)
|
73
|
-
if obj.is_a?
|
73
|
+
if obj.is_a? KisHttp::Headers
|
74
74
|
obj
|
75
75
|
elsif obj.is_a? Hash
|
76
|
-
|
76
|
+
KisHttp::Headers.new(**obj)
|
77
77
|
elsif obj.is_a? Array
|
78
|
-
|
78
|
+
KisHttp::Headers.new(**obj.to_h)
|
79
79
|
else
|
80
80
|
raise 'Invalid object type for Headers!'
|
81
81
|
end
|
data/lib/kis_http/options.rb
CHANGED
@@ -135,12 +135,12 @@ module KisHttp
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def self.Options(obj)
|
138
|
-
if obj.is_a?
|
138
|
+
if obj.is_a? KisHttp::Options
|
139
139
|
obj
|
140
140
|
elsif obj.is_a? Hash
|
141
|
-
|
141
|
+
KisHttp::Options.new(**obj)
|
142
142
|
elsif obj.is_a? Array
|
143
|
-
|
143
|
+
KisHttp::Options.new(**obj.to_h)
|
144
144
|
else
|
145
145
|
raise 'Invalid object type for Options!'
|
146
146
|
end
|
data/lib/kis_http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kis_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel P. Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: DRY for Net::HTTP
|
14
14
|
email:
|