http.rb 1.3.0 → 1.3.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/CHANGELOG +13 -0
- data/lib/HTTP/VERSION.rb +1 -1
- data/lib/Hash/x_www_form_urlencode.rb +3 -6
- data/lib/Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode.rb +27 -0
- data/lib/Thoran/String/Urlencode/urlencode.rb +29 -0
- metadata +5 -4
- data/lib/String/url_encode.rb +0 -24
- /data/lib/{HTTP.rb → http.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c256751d9a000319b5c01326141fab71034662d85cf2393e47170ef73ff3272
|
|
4
|
+
data.tar.gz: e707ce4ff95cab59c75f66a2d29100483da32ad9c3df3e384455be00a202bf2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9b47e3129188137bb30018f85cee74b8d2d8f1daa42a00b0aabf68133286416432f53f107ffe5c8370e6184875f29cef3ffdc48fa113a3bdce8ca2a03cbbb8f
|
|
7
|
+
data.tar.gz: 63edff9c0ec8b79d348de5a6a49737a7683fd74958dc2d33ce99433fc170010600e2477957ae355c6426fc8c725aa6b4a6fee2134136292eb2d7be942e70c94a
|
data/CHANGELOG
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 20260713
|
|
4
|
+
|
|
5
|
+
1.3.1: Use Thoran Namespace for URL-encoding extensions.
|
|
6
|
+
|
|
7
|
+
The String#url_encode and Hash#x_www_form_urlencode extensions reopened the core classes directly. Both now live in named modules under the Thoran:: namespace — Thoran::String::Urlencode and Thoran::Hash::XWwwFormUrlencode — mixed into String and Hash.
|
|
8
|
+
|
|
9
|
+
1. + Thoran::String::Urlencode#urlencode
|
|
10
|
+
2. - String#url_encode
|
|
11
|
+
3. + Thoran::Hash::XWwwFormUrlencode#x_www_form_urlencode
|
|
12
|
+
4. ~ Hash#x_www_form_urlencode: Requires the Thoran namespaced equivalent.
|
|
13
|
+
5. ~ HTTP::VERSION: /1.3.0/1.3.1/
|
|
14
|
+
6. ~ CHANGELOG: + 1.3.1 entry
|
|
15
|
+
|
|
3
16
|
## 20260610
|
|
4
17
|
|
|
5
18
|
1.3.0: Rename VERBS to METHODS; VERBS retained as a deprecated alias.
|
data/lib/HTTP/VERSION.rb
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# Hash/x_www_form_urlencode.rb
|
|
2
2
|
# Hash#x_www_form_urlencode
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
# 20260713
|
|
5
|
+
# 0.2.0
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
def x_www_form_urlencode(joiner = '&')
|
|
8
|
-
inject([]){|a,e| a << "#{e.first.to_s.url_encode.gsub(/ /, '+')}=#{e.last.to_s.url_encode.gsub(/ /, '+')}" unless e.last.nil?; a}.join(joiner)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
7
|
+
require 'Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode.rb
|
|
2
|
+
# Thoran::Hash::XWwwFormUrlencode#x_www_form_urlencode
|
|
3
|
+
|
|
4
|
+
# 20260713
|
|
5
|
+
# 0.3.0
|
|
6
|
+
|
|
7
|
+
# Changes since 0.2:
|
|
8
|
+
# -/0: (The class name and the snake case name really are consistent now.)
|
|
9
|
+
# 1. /XWwwFormUrlEncode/XWwwFormUrlencode/
|
|
10
|
+
# 2. /url_encode/urlencode/
|
|
11
|
+
|
|
12
|
+
require 'Thoran/String/Urlencode/urlencode'
|
|
13
|
+
|
|
14
|
+
module Thoran
|
|
15
|
+
module Hash
|
|
16
|
+
module XWwwFormUrlencode
|
|
17
|
+
|
|
18
|
+
def x_www_form_urlencode(joiner = '&')
|
|
19
|
+
inject([]){|a,e| a << "#{e.first.to_s.urlencode}=#{e.last.to_s.urlencode}" unless e.last.nil?; a}.join(joiner)
|
|
20
|
+
end
|
|
21
|
+
alias_method :x_www_form_url_encode, :x_www_form_urlencode
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Hash.send(:include, Thoran::Hash::XWwwFormUrlencode)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Thoran/String/Urlencode/urlencode.rb
|
|
2
|
+
# Thoran::String::Urlencode#urlencode
|
|
3
|
+
|
|
4
|
+
# 20260713
|
|
5
|
+
# 0.4.0
|
|
6
|
+
|
|
7
|
+
# Acknowledgements: I've simply ripped off and refashioned the code from the CGI module!...
|
|
8
|
+
|
|
9
|
+
# Changes since 0.3:
|
|
10
|
+
# -/0: More consistent naming.
|
|
11
|
+
# 1. /UrlEncode/Urlencode/
|
|
12
|
+
# 2. /url_encode/urlencode/
|
|
13
|
+
|
|
14
|
+
module Thoran
|
|
15
|
+
module String
|
|
16
|
+
module Urlencode
|
|
17
|
+
|
|
18
|
+
def urlencode
|
|
19
|
+
self.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
|
|
20
|
+
'%' + $1.unpack('H2' * $1.size).join('%').upcase
|
|
21
|
+
end.tr(' ', '+')
|
|
22
|
+
end
|
|
23
|
+
alias_method :url_encode, :urlencode
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
String.send(:include, Thoran::String::Urlencode)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http.rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -93,7 +93,6 @@ files:
|
|
|
93
93
|
- README.md
|
|
94
94
|
- Rakefile
|
|
95
95
|
- http.rb.gemspec
|
|
96
|
-
- lib/HTTP.rb
|
|
97
96
|
- lib/HTTP/METHODS.rb
|
|
98
97
|
- lib/HTTP/RETRY.rb
|
|
99
98
|
- lib/HTTP/VERSION.rb
|
|
@@ -104,8 +103,10 @@ files:
|
|
|
104
103
|
- lib/Net/HTTP/set_options.rb
|
|
105
104
|
- lib/Net/HTTPRequest/set_headers.rb
|
|
106
105
|
- lib/Net/HTTPResponse/StatusPredicates.rb
|
|
107
|
-
- lib/
|
|
106
|
+
- lib/Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode.rb
|
|
107
|
+
- lib/Thoran/String/Urlencode/urlencode.rb
|
|
108
108
|
- lib/URI/Generic/use_sslQ.rb
|
|
109
|
+
- lib/http.rb
|
|
109
110
|
- test/HTTP/METHODS_test.rb
|
|
110
111
|
- test/HTTP/RETRY_test.rb
|
|
111
112
|
- test/HTTP/basic_auth_test.rb
|
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
140
|
- !ruby/object:Gem::Version
|
|
140
141
|
version: '0'
|
|
141
142
|
requirements: []
|
|
142
|
-
rubygems_version: 4.0.
|
|
143
|
+
rubygems_version: 4.0.16
|
|
143
144
|
specification_version: 4
|
|
144
145
|
summary: HTTP made easy.
|
|
145
146
|
test_files: []
|
data/lib/String/url_encode.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# String/url_encode.rb
|
|
2
|
-
# String#url_encode
|
|
3
|
-
|
|
4
|
-
# 20130310
|
|
5
|
-
# 0.2.1
|
|
6
|
-
|
|
7
|
-
# Description: When I went looking for a means to url encode and decode strings, I wanted something which used extensions to the String class. Of course there are other means to do url encoding and decoding including using the CGI class, but I liked the approach of having this 'built-in' to strings, rather than the string being passed as a parameter as does CGI. Hence this String extender...
|
|
8
|
-
|
|
9
|
-
# Acknowledgements: I've simply ripped off and refashioned the code from the CGI module!...
|
|
10
|
-
|
|
11
|
-
# Changes since 0.1:
|
|
12
|
-
# 1. The url_encode and url_decode methods now are strictly demarcated.
|
|
13
|
-
# 0/1
|
|
14
|
-
# 2. A small reformat.
|
|
15
|
-
|
|
16
|
-
class String
|
|
17
|
-
|
|
18
|
-
def url_encode
|
|
19
|
-
self.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
|
|
20
|
-
'%' + $1.unpack('H2' * $1.size).join('%').upcase
|
|
21
|
-
end.tr(' ', '+')
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
/data/lib/{HTTP.rb → http.rb}
RENAMED
|
File without changes
|