Class: ProxyAPI::AvailableProxy

Inherits:
Object
  • Object
show all
Defined in:
app/lib/proxy_api/available_proxy.rb

Constant Summary collapse

HTTP_ERRORS =
[
  EOFError,
  Errno::ECONNRESET,
  Errno::EINVAL,
  Net::HTTPBadResponse,
  Net::HTTPHeaderSyntaxError,
  Net::ProtocolError,
  Timeout::Error,
  ProxyAPI::ProxyException
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ AvailableProxy

Returns a new instance of AvailableProxy.



14
15
16
# File 'app/lib/proxy_api/available_proxy.rb', line 14

def initialize(args)
  @args = args
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
# File 'app/lib/proxy_api/available_proxy.rb', line 18

def available?
  begin
    return true if has_scap_feature? && minimum_version
  rescue *HTTP_ERRORS
    return false
  end
  false
end