class TheCount::Twitter
Public Class Methods
new()
click to toggle source
# File lib/thecount/countable/twitter.rb, line 7 def initialize @service_name = "twitter" @unit = "tweet" @value = 0 end
Public Instance Methods
count(data)
click to toggle source
# File lib/thecount/countable/twitter.rb, line 13 def count(data) url = data[:url] begin url = "http://urls.api.twitter.com/1/urls/count.json?url=#{url}" @value = JSON.parse(open(url).string)["count"].to_i rescue Exception => e p e @value = 0 end end