Sha256: 47e318929f4b7f06fee2850697e4c96ba3937523616a79c1632fe4551328e9fc

Contents?: true

Size: 420 Bytes

Versions: 3

Compression:

Stored size: 420 Bytes

Contents

module Popularity
  class GooglePlus < Crawler
    def plus_ones
      matches = response.scan(/window.__SSR = {c\: (\d+.\d+E?\d+)/) 
      matches.flatten.first.to_f.to_i
    end

    def as_json(options = {})
      {"plus_ones" => plus_ones}
    end

    def total
      plus_ones
    end

    protected

    def request_url
      "https://plusone.google.com/_/+1/fastbutton?url=#{URI::encode(@url)}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
popularity-0.1.1 lib/popularity/networks/google_plus.rb
popularity-0.1.0 lib/popularity/networks/google_plus.rb
popularity-0.0.1 lib/popularity/google_plus.rb