Sha256: c7a26d012faa6f5a7098a943fe2a8606de6428194f88f73f525bccd941ed2619

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

module ShareChecker
  module Providers
    class Twitter < Provider
      
      # Response sample
      #
      # twttr.receiveCount({"count":38,"url":"http://www.mcdonaldseurokids2012.com.ua/challenges/1/works/98/"})
      #
      def parse(response)
        if response =~ /^twttr.receiveCount\((.+)\)$/i
          doc = parse_json($1)
          doc.nil? ? 0 : doc["count"].to_i
        end
      end
      
      def url
        "http://urls.api.twitter.com/1/urls/count.json?callback=twttr.receiveCount&url="
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
share_checker-0.1.7 lib/share_checker/providers/twitter.rb