hknife 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hknife/version.rb +1 -1
- data/lib/hknife.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c140f08eb8eab6bae40eda6272ab8f94612aacb9
|
|
4
|
+
data.tar.gz: 2331ebcb9e8758775086998cb15120d5010ca80e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e6d98a4311f46ae32eb75d3e95c7c827628adec853cd84642088a4997a4d1dfb473c5c7c88b889cd18f750cfe278c1f03ec553b898b3fc6ad8fd584668301cc
|
|
7
|
+
data.tar.gz: baab1ace695a40d48e98dbd19ce3aa0832606d5fee313e52c267884a72cbfeb8b0d09b8addee22225bf412eb02c9a302dafb3e2e70403397992f99c0bd497a0c
|
data/lib/hknife/version.rb
CHANGED
data/lib/hknife.rb
CHANGED
|
@@ -19,13 +19,13 @@ module Hknife
|
|
|
19
19
|
|
|
20
20
|
def get(uri)
|
|
21
21
|
uriObj = URI.parse(uri)
|
|
22
|
-
|
|
23
|
-
@http_client =
|
|
22
|
+
@http_client = Net::HTTP.new(uriObj.host, uriObj.port)
|
|
23
|
+
@http_client.use_ssl = uriObj.scheme == 'https'
|
|
24
24
|
@request = Net::HTTP::Get.new(uriObj.path)
|
|
25
25
|
@requestor = lambda do |request|
|
|
26
26
|
res = @http_client.request(request)
|
|
27
27
|
case res['Content-Type']
|
|
28
|
-
when
|
|
28
|
+
when /application\/json/ then
|
|
29
29
|
res.body = JSON.parse(res.body)
|
|
30
30
|
end
|
|
31
31
|
res
|
|
@@ -35,14 +35,14 @@ module Hknife
|
|
|
35
35
|
|
|
36
36
|
def post_form(uri, data)
|
|
37
37
|
uriObj = URI.parse(uri)
|
|
38
|
-
|
|
39
|
-
@http_client =
|
|
38
|
+
@http_client = Net::HTTP.new(uriObj.host, uriObj.port)
|
|
39
|
+
@http_client.use_ssl = uriObj.scheme == 'https'
|
|
40
40
|
@request = Net::HTTP::Post.new(uriObj.path)
|
|
41
41
|
@requestor = lambda do |request|
|
|
42
42
|
res = @http_client.request(@request, URI.encode_www_form(data))
|
|
43
43
|
|
|
44
44
|
case res['Content-Type']
|
|
45
|
-
when
|
|
45
|
+
when /application\/json/ then
|
|
46
46
|
res.body = JSON.parse(res.body)
|
|
47
47
|
end
|
|
48
48
|
res
|