Class: SeoParams::GooglePlus
- Inherits:
-
Object
- Object
- SeoParams::GooglePlus
- Defined in:
- lib/seo_params/google_plus.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ GooglePlus
constructor
A new instance of GooglePlus.
- #plus_ones ⇒ Object
Constructor Details
#initialize(url) ⇒ GooglePlus
Returns a new instance of GooglePlus.
10 11 12 |
# File 'lib/seo_params/google_plus.rb', line 10 def initialize(url) @url = url.match(/^(https?:\/\/)/) ? url : 'http://' + url end |
Instance Method Details
#plus_ones ⇒ Object
14 15 16 17 18 19 |
# File 'lib/seo_params/google_plus.rb', line 14 def plus_ones api_url = "https://plusone.google.com/_/+1/fastbutton?url=#{CGI.escape(@url)}" response = Nokogiri::HTML(open(api_url)) total_plus_ones = response.css("#aggregateCount") convert_count(total_plus_ones.text()) end |