Is the usage of the username
variable just an error in your post? If not, you are overwriting your twitter client instantiation for every account and username
will only contain the last one. Use a hash to store them one by one.
accounts = {}
twitter_accounts.each do |twitter_account|
username = twitter_account['username']
token = twitter_account['oauth_token']
secret = twitter_account['oauth_token_secret']
accounts[username] = Twitter::Client.new(
:oauth_token => token,
:oauth_token_secret => secret
)
end
Thread.new{accounts['erik'].update('test')} # post stuff