Class: PageRankr::Ranks::AlexaGlobal

Inherits:
Object
  • Object
show all
Includes:
PageRankr::Rank
Defined in:
lib/page_rankr/ranks/alexa_global.rb

Instance Attribute Summary

Attributes included from Tracker

#body, #raw, #tracked

Instance Method Summary collapse

Methods included from Tracker

#clean, #content, #initialize, #method, #proxy, #run, #tracked_url

Instance Method Details

#nameObject



30
31
32
# File 'lib/page_rankr/ranks/alexa_global.rb', line 30

def name
  :ranks_alexa_global
end

#paramsObject



12
13
14
# File 'lib/page_rankr/ranks/alexa_global.rb', line 12

def params
  {:cli => 10, :dat => "snbamz", :url => tracked_url}
end

#supported_componentsObject



26
27
28
# File 'lib/page_rankr/ranks/alexa_global.rb', line 26

def supported_components
  [:subdomain]
end

#urlObject



8
9
10
# File 'lib/page_rankr/ranks/alexa_global.rb', line 8

def url
  "http://data.alexa.com/data"
end

#xpathObject

Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if the results returned are for the site we want.

For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this happens we treat the results as if there were no results.



22
23
24
# File 'lib/page_rankr/ranks/alexa_global.rb', line 22

def xpath
   "//popularity/@text"
end