class ProxyService::MechanizeAgent
Constants
- USER_AGENT_ALIASES
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/proxy_service/mechanize_agent.rb, line 6 def initialize super Mechanize.new do |mech| mech.open_timeout = 10 mech.read_timeout = 10 mech.follow_meta_refresh = true mech.keep_alive = true mech.max_history = 1 mech.user_agent_alias = USER_AGENT_ALIASES.sample end end
Public Instance Methods
set_proxy(proxy)
click to toggle source
@note proxy.ip should only be nil in the case where it’s held by a NullWorker @param [#ip, port] proxy object that holds the ip and port
# File lib/proxy_service/mechanize_agent.rb, line 19 def set_proxy(proxy) return unless proxy.ip __getobj__.set_proxy(proxy.ip, proxy.port, ProxyService.username, ProxyService.password) end