Sha256: 78deb085cdeb009a3b70639484672acf2724f784d04b0a262c90af0d5a94e649

Contents?: true

Size: 370 Bytes

Versions: 3

Compression:

Stored size: 370 Bytes

Contents

module Popularity
  class Pinterest < Crawler
    def pins
      JSON.parse(response.gsub('receiveCount(','').gsub(')',''))['count'].to_f.to_i
    end

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

    def total
      pins
    end

    protected

    def request_url
      "http://api.pinterest.com/v1/urls/count.json?url=#{@url}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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