proxied 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/proxied/shared.rb +4 -0
- data/lib/proxied/utilities.rb +12 -2
- data/lib/proxied/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29b91a7c5c377492b4ef67eaca0b0cc0b2a6eb153829fd9853e4fd4ec1d87a9f
|
4
|
+
data.tar.gz: c776549b3460abf6abd40a91d9f5cb96c09d99c03cbaa7939c5da70cf5720ea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17828c85d020f52a43b4734eeda29d78a59733f7085e2350ced4922ccd4c418d96c8f7230d9fd480c19400a1618ba173f7a58fb7ec19a6ca961349093656a00
|
7
|
+
data.tar.gz: 5cfb8dc968ae33409c6bcdb3b7a14ef060032a54c8210b52b765bbf43ee6ee134e8a0bf2a8fc22459b688df2df85c7944905f8b40c94d38c4fcb4d7a6e17557c
|
data/Gemfile.lock
CHANGED
data/lib/proxied/shared.rb
CHANGED
@@ -36,6 +36,10 @@ module Proxied
|
|
36
36
|
def proxy_options_for_faraday
|
37
37
|
::Proxied::Utilities.proxy_options_for_faraday(host: self.host, port: self.port, username: self.username, password: self.password)
|
38
38
|
end
|
39
|
+
|
40
|
+
def proxy_switcher_address
|
41
|
+
::Proxied::Utilities.format_proxy_switcher_address(host: self.host, port: self.port, username: self.username, password: self.password)
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
end
|
data/lib/proxied/utilities.rb
CHANGED
@@ -4,7 +4,7 @@ module Proxied
|
|
4
4
|
class << self
|
5
5
|
|
6
6
|
def format_proxy_address(host:, port: 80, include_http: false)
|
7
|
-
address = "#{host}:#{port}"
|
7
|
+
address = "#{host.strip}:#{port}"
|
8
8
|
address = "http://#{address}" if include_http && !address.start_with?("http://")
|
9
9
|
|
10
10
|
return address
|
@@ -23,7 +23,7 @@ module Proxied
|
|
23
23
|
return credentials
|
24
24
|
end
|
25
25
|
|
26
|
-
def proxy_options_for_faraday(host:, port
|
26
|
+
def proxy_options_for_faraday(host:, port: 80, username: nil, password: nil)
|
27
27
|
proxy_options = {}
|
28
28
|
|
29
29
|
proxy_options[:uri] = format_proxy_address(host: host, port: port, include_http: true)
|
@@ -33,6 +33,16 @@ module Proxied
|
|
33
33
|
return proxy_options
|
34
34
|
end
|
35
35
|
|
36
|
+
def format_proxy_switcher_address(host:, port: 80, username: nil, password: nil)
|
37
|
+
address = ""
|
38
|
+
|
39
|
+
if !username.to_s.empty? && !password.to_s.empty?
|
40
|
+
address += "#{username}:#{password}@"
|
41
|
+
end
|
42
|
+
|
43
|
+
address += "#{host}:#{port}"
|
44
|
+
end
|
45
|
+
|
36
46
|
end
|
37
47
|
|
38
48
|
end
|
data/lib/proxied/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxied
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|