Class: PageRankr::Ranks::AlexaUs
- Inherits:
-
Object
- Object
- PageRankr::Ranks::AlexaUs
show all
- Includes:
- PageRankr::Rank
- Defined in:
- lib/page_rankr/ranks/alexa_us.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
#name ⇒ Object
30
31
32
|
# File 'lib/page_rankr/ranks/alexa_us.rb', line 30
def name
:ranks_alexa_us
end
|
#params ⇒ Object
12
13
14
|
# File 'lib/page_rankr/ranks/alexa_us.rb', line 12
def params
{:cli => 10, :dat => "snbamz", :url => tracked_url}
end
|
#supported_components ⇒ Object
26
27
28
|
# File 'lib/page_rankr/ranks/alexa_us.rb', line 26
def supported_components
[:domain]
end
|
#url ⇒ Object
8
9
10
|
# File 'lib/page_rankr/ranks/alexa_us.rb', line 8
def url
"http://data.alexa.com/data"
end
|
#xpath ⇒ Object
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_us.rb', line 22
def xpath
"//popularity[contains(@url, '#{tracked_url}')]/../reach/@rank"
end
|