Sha256: eadc23fbea6f72c5e1d5cbe81f4f802379186993df84901593e487bce40190bb

Contents?: true

Size: 457 Bytes

Versions: 2

Compression:

Stored size: 457 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
virility-0.0.6 lib/virility/strategies/plus_one.rb
virility-0.0.5 lib/virility/strategies/plus_one.rb