webpurify 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 0bd23d5938aeb50814dbe710b871ed54d55c1cdd7a94fa614e1eea7a1cf237be
4
- data.tar.gz: 65c0a7ff6bda948fed5c531b6cf290c7855cbe19b005356a0fe302725a287b43
2
+ SHA1:
3
+ metadata.gz: f6d2603e140f48e687cdc9061d3e9a88c397cb2e
4
+ data.tar.gz: 8010a3c177497b00b9747d46de2feab1c7c9c4a7
5
5
  SHA512:
6
- metadata.gz: c37758430dc0b175de8450bfac351fdbe044265491b18f5cf08525f887d89475e2bdacfda3043a4c1fca1677b1b099bb85d0cc876d86be722c6a9ba79ea7fdc9
7
- data.tar.gz: ef04da59cf745f914754936228be0a6223f78e1bad9c941603d75570e4f7c18d57f7bb9b780dfbcc044033b259758ca6219cac1d9105da0d7df5edfc8ecab851
6
+ metadata.gz: 053de592de9c6018e073846bc3bb19dfa91948c1ad876220b09211452c29dfd513e2be678d2f2a76b69b15a8b80c0fdb8ab99f071e98b994ddb427cd16071bab
7
+ data.tar.gz: 721e14189cb76c7bc53ef707fa7c980d016553d3fdc8298ee24ea693575b4e9e7d3f02b3ab6bccfb446ce199699e2140a09aa30bac4efde08227f30b93a4b0a9
@@ -1,6 +1,5 @@
1
1
  require 'uri'
2
- require 'net/http'
3
- require 'net/https'
2
+ require 'open-uri'
4
3
  require 'json'
5
4
 
6
5
  module WebPurify
@@ -36,6 +35,8 @@ module WebPurify
36
35
  end
37
36
 
38
37
 
38
+ # TODO: Request handling can be dramatically simplified using 'open-uri'
39
+ #
39
40
  # Executes a query to the API endpoint
40
41
  #
41
42
  # @param request_base [Hash] The base parameters for the request (comes from WebPurify::Client initialize())
@@ -50,7 +51,7 @@ module WebPurify
50
51
  :path => request_base[:path],
51
52
  :query => WebPurify::Request.to_query(q)
52
53
  )
53
- res = JSON.parse(WebPurify::Request.get(uri, request_base[:scheme]), :symbolize_names => true)[WRAPPER]
54
+ res = JSON.parse(WebPurify::Request.get(uri), :symbolize_names => true)[WRAPPER]
54
55
  if res[:err]
55
56
  err_attrs = res[:err][:@attributes]
56
57
  raise RequestError.new(err_attrs[:code], err_attrs[:msg])
@@ -63,12 +64,9 @@ module WebPurify
63
64
  # Handles making the query according to http or https scheme
64
65
  #
65
66
  # @param uri [String] The uri to be queried
66
- # @param scheme [String] The scheme (http, https)
67
67
  # @return [String] The JSON request response
68
- def self.get(uri, scheme)
69
- req = (scheme=='https') ? Net::HTTPS : Net::HTTP
70
- req.get uri
68
+ def self.get(uri)
69
+ URI.parse(uri.to_s).read
71
70
  end
72
-
73
71
  end
74
- end
72
+ end
@@ -1,3 +1,3 @@
1
1
  module WebPurify
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpurify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Zimmerman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-20 00:00:00.000000000 Z
11
+ date: 2019-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.7.6
112
+ rubygems_version: 2.5.2.3
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: A RubyGem for interfacing with the WebPurify API.