Skip to content

Instantly share code, notes, and snippets.

@zeke
Created October 25, 2012 04:30
Show Gist options
  • Save zeke/3950418 to your computer and use it in GitHub Desktop.
Save zeke/3950418 to your computer and use it in GitHub Desktop.
A simple way to ingest tweets from a Twitter list.
%w(rubygems httparty pry).each {|lib| require lib }
class Twitter
include HTTParty
base_uri 'api.twitter.com/1'
def self.tweets_from_list(user, list, options={})
options[:page] ||= 1
options[:per_page] ||= 5
get("/#{user}/lists/#{list}/statuses.json", options)
end
end
tweets = Twitter.tweets_from_list(:heroku, :crew)
binding.pry
tweets.each do |tweet|
puts "#{tweet["user"]["screen_name"]}: #{tweet["text"]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment