lib/page_rankr/tracker.rb in PageRankr-3.1.2 vs lib/page_rankr/tracker.rb in PageRankr-3.2.0
- old
+ new
@@ -11,12 +11,13 @@
attr_accessor :body
def initialize(site, options = {})
@site = PageRankr::Site(site)
- @options = {:method => method, :headers => {'User-Agent' => 'Page Rankr'}}
+ @options = {:method => method, :headers => {'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11'}}
@options[:params] = params if respond_to? :params
+ @options[:proxy] = proxy
@options.merge!(options)
request.on_complete do |response|
self.body = response.body
self.raw = content(body)
@@ -42,10 +43,14 @@
def method
:get
end
+ def proxy
+ PageRankr.proxy_service.proxy(self.class.name, @site) if PageRankr.proxy_service
+ end
+
def run
hydra = Typhoeus::Hydra.new
hydra.queue request
hydra.run
@@ -70,8 +75,12 @@
if cleaned_content.strip == ''
nil
else
cleaned_content.to_i
end
+ end
+
+ def name
+ raise PageRankr::MethodRequired, "name is undefined for #{self.class.name}"
end
end
end
\ No newline at end of file