http_utilities 1.3.5 → 1.3.6
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/VERSION +1 -1
- data/http_utilities.gemspec +1 -1
- data/lib/http_utilities/http/client.rb +1 -3
- data/lib/http_utilities/http/proxy_support.rb +16 -1
- data/lib/http_utilities.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d8cd7577c21467be7c5c3e7ab82fc2d420c11611a1a5bd91699065ec59fb812
|
4
|
+
data.tar.gz: a3af019e9a29cbb2a7c5a52804e050d0041bad448b0bdc93c7e53819ac83fa53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef1584227d6e214478f739bd36efb3c45b2a82a9b9b8d3fb6dbdfb5e0e2af06017cc24dbde2df0f9205b2f5fa85fd6246ffc8281ca25514b468d24e0a1093b8b
|
7
|
+
data.tar.gz: 299970162f004bb714e73910e414e468d11310a588128da7e697de5f5763bf5ab086829ec7e20c9c1b2758f5729a4d467fb2c31059a76cf4b6902be0b0e5b889
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.6
|
data/http_utilities.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = "http_utilities"
|
6
|
-
s.version = "1.3.
|
6
|
+
s.version = "1.3.6"
|
7
7
|
|
8
8
|
s.authors = ["Sebastian Johnsson"]
|
9
9
|
s.description = "Wrapper for Faraday with additional functionality"
|
@@ -54,9 +54,7 @@ module HttpUtilities
|
|
54
54
|
|
55
55
|
request = HttpUtilities::Http::Request.new(options: options)
|
56
56
|
request.set_proxy_options(options)
|
57
|
-
|
58
57
|
proxy_options = request.generate_proxy_options
|
59
|
-
client_options = client_options.merge(proxy: proxy_options) if proxy_options && !proxy_options.empty?
|
60
58
|
|
61
59
|
connection = Faraday.new(client_options) do |builder|
|
62
60
|
builder.headers[:user_agent] = request.user_agent
|
@@ -74,7 +72,7 @@ module HttpUtilities
|
|
74
72
|
builder.send(:response, response_adapter)
|
75
73
|
end if response_adapters && response_adapters.any?
|
76
74
|
|
77
|
-
|
75
|
+
builder.proxy = proxy_options if proxy_options && !proxy_options.empty?
|
78
76
|
|
79
77
|
builder.adapter adapter
|
80
78
|
end
|
@@ -11,8 +11,11 @@ module HttpUtilities
|
|
11
11
|
if proxy_opts.is_a?(String)
|
12
12
|
set_from_string(proxy_opts)
|
13
13
|
|
14
|
-
elsif proxy_opts.is_a?(Hash)
|
14
|
+
elsif proxy_opts.is_a?(Hash) && !proxy_opts.empty?
|
15
15
|
set_from_hash(proxy_opts)
|
16
|
+
|
17
|
+
elsif proxy_opts.is_a?(Array) && proxy_opts.any?
|
18
|
+
set_from_array(proxy_opts)
|
16
19
|
|
17
20
|
elsif proxy_model_defined? && proxy_opts.is_a?(::Proxy)
|
18
21
|
set_from_object(proxy_opts)
|
@@ -55,6 +58,18 @@ module HttpUtilities
|
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
61
|
+
def set_from_array(proxy_opts)
|
62
|
+
item = proxy_opts.sample
|
63
|
+
|
64
|
+
if item.is_a?(String)
|
65
|
+
set_from_string(item)
|
66
|
+
elsif item.is_a?(Hash) && !item.empty?
|
67
|
+
set_from_hash(item)
|
68
|
+
elsif proxy_model_defined? && item.is_a?(::Proxy)
|
69
|
+
set_from_object(item)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
58
73
|
def set_from_object(proxy_object)
|
59
74
|
if proxy_object
|
60
75
|
self.proxy[:host] = proxy_object.host
|
data/lib/http_utilities.rb
CHANGED