class TheCount::Google::Buzz

Public Class Methods

new() click to toggle source
# File lib/thecount/countable/google.rb, line 10
def initialize
  @service_name = "google"
  @unit = "buzz"
  @value = 0
end

Public Instance Methods

count(data) click to toggle source
# File lib/thecount/countable/google.rb, line 15
def count(data)
  url = "http://www.google.com/buzz/api/buzzThis/buzzCounter?url="
  url = "#{url}#{CGI::escape(data[:url])}"
  begin
    @value = JSON.parse(open(url).string.split('(')[1].split(')')[0])[data[:url]].to_i
  rescue Exception => e
    @value = 0
  end
end