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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e941458f4dc0edce8d17a078fe90d55540a9abb
4
- data.tar.gz: c6ea9cff055b18ea6d02e374937f3cc0bd553ae6
3
+ metadata.gz: c140f08eb8eab6bae40eda6272ab8f94612aacb9
4
+ data.tar.gz: 2331ebcb9e8758775086998cb15120d5010ca80e
5
5
  SHA512:
6
- metadata.gz: ee7d3bf7a6c25a8473152d6a87ba9de7fa08c150dfc38d7afd91da8fdc8538079cb0370426abc588740ef8e9a585347aa01737cbd8dd746249c818fcdfe2edd3
7
- data.tar.gz: 1d94ee5a7e1b8730974685ed29161083664662726038155c51eae101e5cd1409b415c22c63e669517057558222c646ccd330d9a15638d60fee8a7737d1c81a58
6
+ metadata.gz: 1e6d98a4311f46ae32eb75d3e95c7c827628adec853cd84642088a4997a4d1dfb473c5c7c88b889cd18f750cfe278c1f03ec553b898b3fc6ad8fd584668301cc
7
+ data.tar.gz: baab1ace695a40d48e98dbd19ce3aa0832606d5fee313e52c267884a72cbfeb8b0d09b8addee22225bf412eb02c9a302dafb3e2e70403397992f99c0bd497a0c
@@ -1,3 +1,3 @@
1
1
  module Hknife
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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
- port = uriObj.default_port if uriObj.port.nil?
23
- @http_client = Net::HTTP.new(uriObj.host, port)
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 'application/json' then
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
- port = uriObj.default_port if uriObj.port.nil?
39
- @http_client = Net::HTTP.new(uriObj.host, port)
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 'application/json' then
45
+ when /application\/json/ then
46
46
  res.body = JSON.parse(res.body)
47
47
  end
48
48
  res
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hknife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nyamage