Create a twitter list using the Twitter gem

require 'twitter'

# add your ctoken, csecret, atoken, and asecret

Twitter.configure do |config|
  config.consumer_key       = ctoken
  config.consumer_secret    = csecret
  config.oauth_token        = atoken
  config.oauth_token_secret = asecret
end

client = Twitter::Client.new
client.list_create 'scotruby2011'

# twitter_users =  ...  add your list of users
twitter_users.each do |user|
  puts user
  client.list_add_member 'jrobertson', 'scotruby2011', Twitter.user(user).id
end

Creating a twitter list with the twitter gem is relativelystraight forward however I also ended up installing twitter4rbecause of a missing 'base64' file.

Since the Twitter API now uses oAuth you will have to do somebackground reading on how to set up a twitter oAuth connection.

Resources:

Tags:
Source:
1903hrs.txt
Published:
08-06-2014 19:03