Sha256: 52b8eb286ae946a22732d76208a897e8c194303d831e390b5672adc3191a0562

Contents?: true

Size: 439 Bytes

Versions: 8

Compression:

Stored size: 439 Bytes

Contents

# http://stackoverflow.com/questions/7403553/how-do-i-get-the-counter-of-a-google-plus-1-button
module Virility
  class PlusOne < Strategy
  
    parser(
      Proc.new do |body, format|
        {'shares' => body.scan(/c: (\d+)/).flatten.first}
      end
    )
  
    def census
      self.class.get("https://plusone.google.com/_/+1/fastbutton?url=#{@url}")
    end
    
    def count
      results["shares"].to_i || 0
    end
  
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
virility-0.4.0 lib/virility/strategies/plus_one.rb
virility-0.3.1 lib/virility/strategies/plus_one.rb
virility-0.3.0 lib/virility/strategies/plus_one.rb
virility-0.2.0 lib/virility/strategies/plus_one.rb
virility-0.1.4 lib/virility/strategies/plus_one.rb
virility-0.1.3 lib/virility/strategies/plus_one.rb
virility-0.1.2 lib/virility/strategies/plus_one.rb
virility-0.1.1 lib/virility/strategies/plus_one.rb