Return to Snippet

Revision: 29630
at August 2, 2010 10:51 by pdxmph


Initial Code
#!/usr/bin/env ruby

require "rubygems"
require "twitter"
require "active_support"
require "google_chart"


twitter_user = ""
twitter_pass = ""

httpauth = Twitter::HTTPAuth.new(twitter_user, twitter_pass)
client = Twitter::Base.new(httpauth)

totals = {}

client.friends_timeline(:count => 200).each do |t|
  user = t.user.screen_name
  if !totals.has_key? user
    totals[user] = 1
  else 
    totals[user] +=1
  end
end

pc = GoogleChart::PieChart.new('500x200', "Total Proportion of Recent Tweets", false)

totals.each do |key,val|
  pc.data key, val
end

puts pc.to_url

Initial URL

                                

Initial Description

                                

Initial Title
Chart Total Proportion of Recent Tweets by Friend

Initial Tags
ruby, twitter

Initial Language
Ruby