Class: ProxiClean::Client
- Inherits:
-
Object
- Object
- ProxiClean::Client
- Defined in:
- lib/proxi_clean/client.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#public_ip ⇒ Object
readonly
Returns the value of attribute public_ip.
Instance Method Summary collapse
-
#initialize(debug = false) ⇒ Client
constructor
A new instance of Client.
- #proxied_ip(proxy_uri) ⇒ Object
- #works?(proxy_uri) ⇒ Boolean
Constructor Details
#initialize(debug = false) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/proxi_clean/client.rb', line 8 def initialize(debug=false) @debug = debug public_ip end |
Instance Attribute Details
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
6 7 8 |
# File 'lib/proxi_clean/client.rb', line 6 def debug @debug end |
#public_ip ⇒ Object (readonly)
Returns the value of attribute public_ip.
6 7 8 |
# File 'lib/proxi_clean/client.rb', line 6 def public_ip @public_ip end |
Instance Method Details
#proxied_ip(proxy_uri) ⇒ Object
31 32 33 |
# File 'lib/proxi_clean/client.rb', line 31 def proxied_ip(proxy_uri) real_ip(proxy_uri: proxy_uri) end |
#works?(proxy_uri) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/proxi_clean/client.rb', line 13 def works?(proxy_uri) begin puts 'Checking: ' + proxy_uri if @debug proxied_ip = proxied_ip(proxy_uri) rescue StandardError => e puts 'ERROR: ' + e. if @debug # If anything goes wrong, assuming the proxy is no good return false end public_ip != proxied_ip end |