Class: Cosgrove::Agent
- Inherits:
-
Mechanize
- Object
- Mechanize
- Cosgrove::Agent
- Defined in:
- lib/cosgrove/agent.rb
Instance Method Summary collapse
-
#initialize ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize ⇒ Agent
Returns a new instance of Agent.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cosgrove/agent.rb', line 7 def initialize super('cosgrove') @agent.user_agent = 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405' @agent.keep_alive = false @agent.open_timeout = 10 @agent.read_timeout = 10 # Cookie management, see: https://gist.github.com/makevoid/4282237 @agent.pre_connect_hooks << Proc.new do @agent..load COOKIE_FILE if ::File.exist?(COOKIE_FILE) end @agent.post_connect_hooks << Proc.new do @agent..save COOKIE_FILE end end |