http.rb 0.24.0 → 0.25.0
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 +14 -0
- data/http.rb.gemspec +1 -1
- data/lib/HTTP/VERSION.rb +1 -1
- data/lib/HTTP/verbs.rb +2 -3
- data/lib/HTTP.rb +0 -3
- metadata +2 -6
- data/lib/String/to_const.rb +0 -7
- data/lib/Thoran/Array/AllButFirst/all_but_first.rb +0 -28
- data/lib/Thoran/Array/FirstX/firstX.rb +0 -32
- data/lib/Thoran/String/ToConst/to_const.rb +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e13135b5b435a5698be8796e1b9875519747ec50ef9b67c28b81e2f635f43934
|
|
4
|
+
data.tar.gz: 05adbd72d459b796093914c3e47b1be023fd543a41305b4fa42b8d90e3fc3a6a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db5b30d4185591e0a52fb740514f135b4bd21e06482f160d1ecf7c6c69068e57d8b27e2af9735d8beabd8e41a33ad4f25e400d9ed9999225b576b3ef79e4d545
|
|
7
|
+
data.tar.gz: a751c3f915491a27cbea213524c5c83271b3b61b1c7b04c9c279e8f26956b718d45467a970a0eb22eb5d5d7bc710cbb6074105dbb55cdd61c7f257424a621dd2
|
data/CHANGELOG
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## 20260522
|
|
4
4
|
|
|
5
|
+
0.25.0: Remove unused internal machinery; require Ruby >= 3.2.
|
|
6
|
+
|
|
7
|
+
1. ~ HTTP/verbs.rb: /"Net::HTTP::#{verb.to_s.capitalize}".to_const/Net::HTTP.const_get(verb.to_s.capitalize)/. The recursive String#to_const was overkill for a single-level lookup inside Net::HTTP; const_get does it directly.
|
|
8
|
+
2. - lib/String/to_const.rb
|
|
9
|
+
3. - lib/Thoran/String/ToConst/to_const.rb
|
|
10
|
+
4. - lib/Thoran/Array/AllButFirst/all_but_first.rb (was only used by to_const)
|
|
11
|
+
5. - lib/Thoran/Array/FirstX/firstX.rb (was only used by all_but_first)
|
|
12
|
+
6. ~ lib/HTTP.rb: Remove $LOAD_PATH.unshift; rubygems puts lib/ on the load path for installed gems and bundler does the same for local development.
|
|
13
|
+
7. ~ http.rb.gemspec: /required_ruby_version = '>= 2.7'/required_ruby_version = '>= 3.2'/. Aligns with the minitest 6.0 floor used in development; the runtime would still load on 2.7, but claiming compatibility with a Ruby the test suite can't be run against is a fiction worth ending before 1.0.
|
|
14
|
+
8. ~ HTTP::VERSION: /0.24.0/0.25.0/
|
|
15
|
+
9. ~ CHANGELOG: + 0.25.0 entry
|
|
16
|
+
|
|
17
|
+
## 20260522
|
|
18
|
+
|
|
5
19
|
0.24.0: ok? predicate now means 200 specifically.
|
|
6
20
|
|
|
7
21
|
1. ~ Net::HTTPResponse::StatusPredicates: ok? is now defined as @code == '200' rather than aliased to successful?. The alias semantics (any 2xx) misled — "OK" is the reason-phrase for 200 specifically, not the 2xx class. Migration: callers wanting any-2xx should use successful? (or its alias success?).
|
data/http.rb.gemspec
CHANGED
data/lib/HTTP/VERSION.rb
CHANGED
data/lib/HTTP/verbs.rb
CHANGED
|
@@ -6,7 +6,6 @@ require 'net/http'
|
|
|
6
6
|
|
|
7
7
|
require_relative '../Hash/x_www_form_urlencode'
|
|
8
8
|
require_relative './request'
|
|
9
|
-
require_relative '../String/to_const'
|
|
10
9
|
|
|
11
10
|
module HTTP
|
|
12
11
|
module VERBS
|
|
@@ -21,7 +20,7 @@ module HTTP
|
|
|
21
20
|
unless args.empty?
|
|
22
21
|
request_uri += '?' + args.x_www_form_urlencode
|
|
23
22
|
end
|
|
24
|
-
request_object =
|
|
23
|
+
request_object = Net::HTTP.const_get(verb.to_s.capitalize).new(request_uri)
|
|
25
24
|
request(uri, request_object, headers, options, &block)
|
|
26
25
|
end
|
|
27
26
|
|
|
@@ -31,7 +30,7 @@ module HTTP
|
|
|
31
30
|
VERBS::WITH_BODY.each do |verb|
|
|
32
31
|
define_method(verb) do |uri, data = {}, headers = {}, options = {}, &block|
|
|
33
32
|
uri = uri.is_a?(URI) ? uri : URI.parse(uri)
|
|
34
|
-
request_object =
|
|
33
|
+
request_object = Net::HTTP.const_get(verb.to_s.capitalize).new(uri.request_uri)
|
|
35
34
|
content_type = headers.find{|k, v| k.downcase == 'content-type'}&.last.to_s
|
|
36
35
|
if data.is_a?(String)
|
|
37
36
|
request_object.body = data
|
data/lib/HTTP.rb
CHANGED
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: 0.
|
|
4
|
+
version: 0.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -102,11 +102,7 @@ files:
|
|
|
102
102
|
- lib/Net/HTTP/set_options.rb
|
|
103
103
|
- lib/Net/HTTPRequest/set_headers.rb
|
|
104
104
|
- lib/Net/HTTPResponse/StatusPredicates.rb
|
|
105
|
-
- lib/String/to_const.rb
|
|
106
105
|
- lib/String/url_encode.rb
|
|
107
|
-
- lib/Thoran/Array/AllButFirst/all_but_first.rb
|
|
108
|
-
- lib/Thoran/Array/FirstX/firstX.rb
|
|
109
|
-
- lib/Thoran/String/ToConst/to_const.rb
|
|
110
106
|
- lib/URI/Generic/use_sslQ.rb
|
|
111
107
|
- test/HTTP/RETRY_test.rb
|
|
112
108
|
- test/HTTP/delete_test.rb
|
|
@@ -130,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
130
126
|
requirements:
|
|
131
127
|
- - ">="
|
|
132
128
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '2
|
|
129
|
+
version: '3.2'
|
|
134
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
131
|
requirements:
|
|
136
132
|
- - ">="
|
data/lib/String/to_const.rb
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Thoran/Array/AllButFirst/all_but_first.rb
|
|
2
|
-
# Thoran::Array::AllButFirst#all_but_first
|
|
3
|
-
|
|
4
|
-
# 20141223
|
|
5
|
-
# 0.1.0
|
|
6
|
-
|
|
7
|
-
# Description: This returns a copy of the receiving array with the first element removed.
|
|
8
|
-
|
|
9
|
-
# Changes:
|
|
10
|
-
# 1. + Thoran namespace.
|
|
11
|
-
|
|
12
|
-
require 'Thoran/Array/FirstX/firstX'
|
|
13
|
-
|
|
14
|
-
module Thoran
|
|
15
|
-
module Array
|
|
16
|
-
module AllButFirst
|
|
17
|
-
|
|
18
|
-
def all_but_first
|
|
19
|
-
d = self.dup
|
|
20
|
-
d.first!
|
|
21
|
-
d
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
Array.send(:include, Thoran::Array::AllButFirst)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Thoran/Array/FirstX/firstX.rb
|
|
2
|
-
# Thoran::Array::FirstX#first!
|
|
3
|
-
|
|
4
|
-
# 20180804
|
|
5
|
-
# 0.3.3
|
|
6
|
-
|
|
7
|
-
# Description: Sometimes it makes more sense to treat arrays this way.
|
|
8
|
-
|
|
9
|
-
# Changes since 0.2:
|
|
10
|
-
# 1. Added the original version 0.1.0 of the implementation to the later 0.1.0!
|
|
11
|
-
# 0/1
|
|
12
|
-
# 2. Switched the tests to spec-style.
|
|
13
|
-
# 1/2
|
|
14
|
-
# 3. Added a test for the state of the array afterward, since this is meant to be an in place change.
|
|
15
|
-
# 2/3
|
|
16
|
-
# 4. Added tests for the extended functionality introduced in the first version 0.1.0.
|
|
17
|
-
|
|
18
|
-
module Thoran
|
|
19
|
-
module Array
|
|
20
|
-
module FirstX
|
|
21
|
-
|
|
22
|
-
def first!(n = 1)
|
|
23
|
-
return_value = []
|
|
24
|
-
n.times{return_value << self.shift}
|
|
25
|
-
return_value.size == 1 ? return_value[0] : return_value
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Array.send(:include, Thoran::Array::FirstX)
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Thoran/String/ToConst/to_const.rb
|
|
2
|
-
# Thoran::String::ToConst#to_const
|
|
3
|
-
|
|
4
|
-
# 20141223
|
|
5
|
-
# 0.2.0
|
|
6
|
-
|
|
7
|
-
# Description: This takes a string and returns a constant, with unlimited namespacing.
|
|
8
|
-
|
|
9
|
-
# History: Derived from Object#to_const 0.3.0, and superceding Object#to_const.
|
|
10
|
-
|
|
11
|
-
# Changes:
|
|
12
|
-
# 1. + Thoran namespace.
|
|
13
|
-
|
|
14
|
-
# Todo:
|
|
15
|
-
# 1. This only works for two levels of constants. Three and you're stuffed. So, this needs to be recursive...
|
|
16
|
-
# Done iteratively as of 0.1.0.
|
|
17
|
-
# 2. Make this work for symbols. However, this will only work if there's no namespacing. ie. :A is OK, but :A::B is not.
|
|
18
|
-
|
|
19
|
-
# Discussion:
|
|
20
|
-
# 1. Should this go separately into classes for which ::const_get will work and be removed from Object? Done as of 0.1.0.
|
|
21
|
-
|
|
22
|
-
require 'Thoran/Array/AllButFirst/all_but_first'
|
|
23
|
-
|
|
24
|
-
module Thoran
|
|
25
|
-
module String
|
|
26
|
-
module ToConst
|
|
27
|
-
|
|
28
|
-
def to_const
|
|
29
|
-
if self =~ /::/
|
|
30
|
-
constants = self.split('::')
|
|
31
|
-
constant = Object.const_get(constants.first)
|
|
32
|
-
constants = constants.all_but_first
|
|
33
|
-
until constants.empty? do
|
|
34
|
-
constant = constant.const_get(constants.shift)
|
|
35
|
-
end
|
|
36
|
-
else
|
|
37
|
-
constant = Object.const_get(self)
|
|
38
|
-
end
|
|
39
|
-
constant
|
|
40
|
-
end
|
|
41
|
-
alias_method :to_constant, :to_const
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
String.send(:include, Thoran::String::ToConst)
|