webpurify 1.0.1 → 1.0.2
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 +5 -5
- data/lib/web_purify/request.rb +11 -11
- data/lib/web_purify/version.rb +1 -1
- data/web_purify.gemspec +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9b370624873ef7328f427155979aae3633b4fd73f14b3e80ecbbd30c4734313a
|
4
|
+
data.tar.gz: e1a266a85bb376893f4b49750abd39c402164e15407279f81b1306636a39edb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5aaace36db41cf9fe29a217b2cccdb4ee414379e261774c9be0e3e9b73e20999a93fea41ed1b44023f8a50a3e24a099bea73841e9ce3a2b922c20307cdaf5ff
|
7
|
+
data.tar.gz: 43c7bf433d9cb0b0f89ef4094ba19c81708070dcb3500dc2345d2c2834e189b05df4695299435e5f70df39832cea462e42151e4292ee575f003b7700ef4674b9
|
data/lib/web_purify/request.rb
CHANGED
@@ -3,23 +3,23 @@ require 'open-uri'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module WebPurify
|
6
|
-
|
6
|
+
|
7
7
|
# WebPurify::Request
|
8
8
|
#
|
9
9
|
# WebPurify::Request handles the HTTP/HTTPS queries to the API endpoints,
|
10
10
|
# converting returned JSON into a usable object.
|
11
11
|
module Request
|
12
|
-
|
12
|
+
|
13
13
|
WRAPPER = :rsp
|
14
|
-
|
14
|
+
|
15
15
|
class RequestError < StandardError
|
16
16
|
attr_accessor :code, :msg
|
17
|
-
|
17
|
+
|
18
18
|
def initialize code, msg
|
19
19
|
@code = code
|
20
20
|
@msg = msg
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def to_s
|
24
24
|
"[#{@code}] #{@msg}"
|
25
25
|
end
|
@@ -31,11 +31,11 @@ module WebPurify
|
|
31
31
|
# @param hash [Hash] The hash to be converted
|
32
32
|
# @return [String] The formatted query string
|
33
33
|
def self.to_query(hash)
|
34
|
-
return URI.
|
34
|
+
return URI.encode_www_form(hash)
|
35
35
|
end
|
36
|
-
|
37
|
-
|
38
|
-
# TODO: Request handling can be dramatically simplified using 'open-uri'
|
36
|
+
|
37
|
+
|
38
|
+
# TODO: Request handling can be dramatically simplified using 'open-uri'
|
39
39
|
#
|
40
40
|
# Executes a query to the API endpoint
|
41
41
|
#
|
@@ -48,7 +48,7 @@ module WebPurify
|
|
48
48
|
uri_builder = (request_base[:scheme]=='https') ? URI::HTTPS : URI::HTTP
|
49
49
|
uri = uri_builder.build(
|
50
50
|
:host => request_base[:host],
|
51
|
-
:path => request_base[:path],
|
51
|
+
:path => request_base[:path],
|
52
52
|
:query => WebPurify::Request.to_query(q)
|
53
53
|
)
|
54
54
|
res = JSON.parse(WebPurify::Request.get(uri), :symbolize_names => true)[WRAPPER]
|
@@ -60,7 +60,7 @@ module WebPurify
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
|
64
64
|
# Handles making the query according to http or https scheme
|
65
65
|
#
|
66
66
|
# @param uri [String] The uri to be queried
|
data/lib/web_purify/version.rb
CHANGED
data/web_purify.gemspec
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Zimmerman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.10.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: 3.10.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: vcr
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,7 +93,7 @@ files:
|
|
93
93
|
homepage: https://github.com/mileszim/webpurify-gem
|
94
94
|
licenses: []
|
95
95
|
metadata: {}
|
96
|
-
post_install_message:
|
96
|
+
post_install_message:
|
97
97
|
rdoc_options: []
|
98
98
|
require_paths:
|
99
99
|
- lib
|
@@ -108,13 +108,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
signing_key:
|
111
|
+
rubygems_version: 3.2.22
|
112
|
+
signing_key:
|
114
113
|
specification_version: 4
|
115
114
|
summary: A RubyGem for interfacing with the WebPurify API.
|
116
115
|
test_files:
|
117
116
|
- spec/spec_helper.rb
|
118
117
|
- spec/support/vcr.rb
|
119
|
-
- spec/web_purify/methods/text_filters_spec.rb
|
120
118
|
- spec/web_purify/methods/image_filters_spec.rb
|
119
|
+
- spec/web_purify/methods/text_filters_spec.rb
|