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 +5 -5
- data/lib/web_purify/request.rb +7 -9
- data/lib/web_purify/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6d2603e140f48e687cdc9061d3e9a88c397cb2e
|
4
|
+
data.tar.gz: 8010a3c177497b00b9747d46de2feab1c7c9c4a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 053de592de9c6018e073846bc3bb19dfa91948c1ad876220b09211452c29dfd513e2be678d2f2a76b69b15a8b80c0fdb8ab99f071e98b994ddb427cd16071bab
|
7
|
+
data.tar.gz: 721e14189cb76c7bc53ef707fa7c980d016553d3fdc8298ee24ea693575b4e9e7d3f02b3ab6bccfb446ce199699e2140a09aa30bac4efde08227f30b93a4b0a9
|
data/lib/web_purify/request.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'uri'
|
2
|
-
require '
|
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
|
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
|
69
|
-
|
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
|
data/lib/web_purify/version.rb
CHANGED
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.
|
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:
|
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.
|
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.
|