Module: Spidr::Settings::Proxy

Included in:
Spidr, Spidr::SessionCache
Defined in:
lib/spidr/settings/proxy.rb

Overview

Methods for configuring a proxy.

Since:

  • 0.6.0

Instance Method Summary collapse

Instance Method Details

#disable_proxy!Object

Disables the proxy settings used by all newly created Agent objects.

Since:

  • 0.6.0


55
56
57
58
# File 'lib/spidr/settings/proxy.rb', line 55

def disable_proxy!
  @proxy = Spidr::Proxy.new
  return true
end

#proxySpidr::Proxy

Proxy information used by all newly created Agent objects by default.

Returns:

Since:

  • 0.6.0


17
18
19
# File 'lib/spidr/settings/proxy.rb', line 17

def proxy
  @proxy ||= Spidr::Proxy.new
end

#proxy=(new_proxy) ⇒ Spidr::Proxy

Sets the proxy information used by Agent objects.

Parameters:

  • new_proxy (Spidr::Proxy, Hash, nil)

    The new proxy information.

Options Hash (new_proxy):

  • :host (String)

    The host-name of the proxy.

  • :port (Integer) — default: COMMON_PROXY_PORT

    The port of the proxy.

  • :user (String)

    The user to authenticate with the proxy as.

  • :password (String)

    The password to authenticate with the proxy.

Returns:

Since:

  • 0.6.0


42
43
44
45
46
47
48
49
50
# File 'lib/spidr/settings/proxy.rb', line 42

def proxy=(new_proxy)
  @proxy = case new_proxy
           when Spidr::Proxy then new_proxy
           when Hash         then Spidr::Proxy.new(new_proxy)
           when nil          then Spidr::Proxy.new
           else
             raise(TypeError,"#{self.class}#{__method__} only accepts Proxy, Hash or nil")
           end
end