Sha256: 108ff19618862098f08e2692e1ad8ee4739e58710ad55408b1692f5aa0f9baf9

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

require 'json'

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
          obj = JSON.parse($1)
          obj["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.0 lib/share_checker/providers/twitter.rb