Sha256: 48c21f73fab92000047dcc81115a4f8d89dbe7074a4fc62477e9dfa0ff3fb374

Contents?: true

Size: 957 Bytes

Versions: 9

Compression:

Stored size: 957 Bytes

Contents

require File.expand_path('../../rank', __FILE__)

module PageRankr
  class Ranks
    class AlexaUs
      include Rank
      
      def url
        "http://data.alexa.com/data"
      end

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

      # 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.
      def xpath
        "//popularity[contains(@url, '#{tracked_url}')]/../reach/@rank"
      end

      def supported_components
        [:domain]
      end

      def name
        :ranks_alexa_us
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
PageRankr-4.4.0 lib/page_rankr/ranks/alexa_us.rb
PageRankr-4.3.0 lib/page_rankr/ranks/alexa_us.rb
PageRankr-4.2.1 lib/page_rankr/ranks/alexa_us.rb
PageRankr-4.2.0 lib/page_rankr/ranks/alexa_us.rb
PageRankr-4.1.1 lib/page_rankr/ranks/alexa_us.rb
PageRankr-4.1.0 lib/page_rankr/ranks/alexa_us.rb
PageRankr-4.0.0 lib/page_rankr/ranks/alexa_us.rb
PageRankr-3.2.1 lib/page_rankr/ranks/alexa_us.rb
PageRankr-3.2.0 lib/page_rankr/ranks/alexa_us.rb