Class: Undead::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/undead/agent.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  js_errors: false,
  timeout: 1000,
  headers: {
    'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X)"
  },
}

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Agent

Returns a new instance of Agent.



13
14
15
# File 'lib/undead/agent.rb', line 13

def initialize(options = {})
  @session = Driver.new(DEFAULT_OPTIONS.merge(options))
end

Instance Method Details

#get(url) ⇒ Object



17
18
19
20
# File 'lib/undead/agent.rb', line 17

def get(url)
  @session.visit url
  @session.html
end