http_utilities 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d35f4d16afe0c14fb152deaa1f4f9499149b8092597048a9634ba7a18c2107fd
4
- data.tar.gz: 9e1accc76b228e69dae8e9ab656451720dc75d2136c3988624eed5e8f8775aad
3
+ metadata.gz: 1d8cd7577c21467be7c5c3e7ab82fc2d420c11611a1a5bd91699065ec59fb812
4
+ data.tar.gz: a3af019e9a29cbb2a7c5a52804e050d0041bad448b0bdc93c7e53819ac83fa53
5
5
  SHA512:
6
- metadata.gz: 5d8a4cf017084eb7227864328e86a118f143001e5201238987c000065214e74c9303dea25f9da4a28ac68b22ca20b098281cd7d8927e5e97227bd78b65bccdec
7
- data.tar.gz: 9c9845c448c6f8135b6ab9fc437a1beafafa0352aad04e9f24794182bff1f0b62e2a6d1843fd4a9c2df85e8faa7dfe1c67eb6f267289a3e44a5cf85c45a2356c
6
+ metadata.gz: ef1584227d6e214478f739bd36efb3c45b2a82a9b9b8d3fb6dbdfb5e0e2af06017cc24dbde2df0f9205b2f5fa85fd6246ffc8281ca25514b468d24e0a1093b8b
7
+ data.tar.gz: 299970162f004bb714e73910e414e468d11310a588128da7e697de5f5763bf5ab086829ec7e20c9c1b2758f5729a4d467fb2c31059a76cf4b6902be0b0e5b889
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.5
1
+ 1.3.6
@@ -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.5"
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
- #builder.proxy proxy_options unless proxy_options.empty?
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
@@ -5,7 +5,7 @@ require "faraday_middleware"
5
5
  require "mechanize"
6
6
 
7
7
  module HttpUtilities
8
- VERSION = "1.3.5"
8
+ VERSION = "1.3.6"
9
9
 
10
10
  require File.join(File.dirname(__FILE__), 'http_utilities/railtie') if defined?(Rails)
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson