Module: Spidr

Defined in:
lib/spidr/body.rb,
lib/spidr/page.rb,
lib/spidr/agent.rb,
lib/spidr/links.rb,
lib/spidr/rules.rb,
lib/spidr/spidr.rb,
lib/spidr/events.rb,
lib/spidr/filters.rb,
lib/spidr/headers.rb,
lib/spidr/version.rb,
lib/spidr/auth_store.rb,
lib/spidr/cookie_jar.rb,
lib/spidr/sanitizers.rb,
lib/spidr/session_cache.rb,
lib/spidr/actions/actions.rb,
lib/spidr/auth_credential.rb,
lib/spidr/actions/exceptions/action.rb,
lib/spidr/actions/exceptions/paused.rb,
lib/spidr/actions/exceptions/skip_link.rb,
lib/spidr/actions/exceptions/skip_page.rb

Defined Under Namespace

Modules: Actions, Body, Events, Filters, Headers, Links, Sanitizers Classes: Agent, AuthCredential, AuthStore, CookieJar, Page, Rules, SessionCache

Constant Summary collapse

COMMON_PROXY_PORT =

Common proxy port.

8080
DEFAULT_PROXY =

Default proxy information.

{
  :host => nil,
  :port => COMMON_PROXY_PORT,
  :user => nil,
  :password => nil
}
VERSION =

Spidr version

'0.3.2'

Class Method Summary collapse

Class Method Details

.disable_proxy!Object

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



53
54
55
56
# File 'lib/spidr/spidr.rb', line 53

def Spidr.disable_proxy!
  @@spidr_proxy = DEFAULT_PROXY
  return true
end

.host(name, options = {}, &block) ⇒ Object

See Also:



88
89
90
# File 'lib/spidr/spidr.rb', line 88

def Spidr.host(name,options={},&block)
  Agent.host(name,options,&block)
end

.proxyHash

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

Returns:

  • (Hash)

    The Spidr proxy information.



21
22
23
# File 'lib/spidr/spidr.rb', line 21

def Spidr.proxy
  @@spidr_proxy ||= DEFAULT_PROXY
end

.proxy=(new_proxy) ⇒ Hash

Sets the proxy information used by Agent objects.

Parameters:

  • new_proxy (Hash)

    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:

  • (Hash)

    The new proxy information.



46
47
48
# File 'lib/spidr/spidr.rb', line 46

def Spidr.proxy=(new_proxy)
  @@spidr_proxy = {:port => COMMON_PROXY_PORT}.merge(new_proxy)
end

.site(url, options = {}, &block) ⇒ Object

See Also:



95
96
97
# File 'lib/spidr/spidr.rb', line 95

def Spidr.site(url,options={},&block)
  Agent.site(url,options,&block)
end

.start_at(url, options = {}, &block) ⇒ Object



81
82
83
# File 'lib/spidr/spidr.rb', line 81

def Spidr.start_at(url,options={},&block)
  Agent.start_at(url,options,&block)
end

.user_agentString

The User-Agent string used by all Agent objects by default.

Returns:

  • (String)

    The Spidr User-Agent string.



64
65
66
# File 'lib/spidr/spidr.rb', line 64

def Spidr.user_agent
  @@spidr_user_agent ||= nil
end

.user_agent=(new_agent) ⇒ Object

Sets the Spidr User-Agent string.

Parameters:

  • new_agent (String)

    The new User-Agent string.



74
75
76
# File 'lib/spidr/spidr.rb', line 74

def Spidr.user_agent=(new_agent)
  @@spidr_user_agent = new_agent
end