Class: SeoParams::Alexa
- Inherits:
-
Object
- Object
- SeoParams::Alexa
- Defined in:
- lib/seo_params/alexa.rb
Instance Method Summary collapse
- #dmoz ⇒ Object
-
#initialize(url) ⇒ Alexa
constructor
A new instance of Alexa.
- #rank ⇒ Object
Constructor Details
#initialize(url) ⇒ Alexa
Returns a new instance of Alexa.
9 10 11 12 |
# File 'lib/seo_params/alexa.rb', line 9 def initialize(url) @url = url @response = Nokogiri::HTML(open("http://xml.alexa.com/data?cli=10&dat=nsa&ver=quirk-searchstatus&url=#{url}")) end |
Instance Method Details
#dmoz ⇒ Object
23 24 25 |
# File 'lib/seo_params/alexa.rb', line 23 def dmoz @response.xpath("//alexa/dmoz").length > 0 ? "yes" : "no" end |
#rank ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/seo_params/alexa.rb', line 14 def rank begin rank = @response.css("popularity").attr("text").content().to_i rescue rank = nil end rank end |