class TheCount::Digg
Public Class Methods
new()
click to toggle source
# File lib/thecount/countable/digg.rb, line 7 def initialize @service_name = "digg" @unit = "digg" @value = 0 end
Public Instance Methods
count(data)
click to toggle source
# File lib/thecount/countable/digg.rb, line 13 def count(data) url = data[:url] begin url = "http://widgets.digg.com/buttons/count?url=#{url}" @value = JSON.parse(open(url).string.split("(")[1].split(");")[0])["diggs"].to_i rescue @value = 0 end end