Skip to content

Instantly share code, notes, and snippets.

@cantlin
Created March 31, 2011 04:22
Show Gist options
  • Save cantlin/895808 to your computer and use it in GitHub Desktop.
Save cantlin/895808 to your computer and use it in GitHub Desktop.
def following(cursor = -1)
Rails.cache.fetch("following/#{id}", :expires_in => 1.hour) do
result = twitter_request_authenticated('get_following', {:cursor => cursor})
followed_users = parse_body(result)['users']
twitter_user_list = []
followed_users.each do |user|
# this_user = TwitterUser.new(:twitter_id => user['id'], :screen_name => user['screen_name'], :name => user['name'], :image => user['profile_image_url'], :location => user['location'])
this_user = {'twitter_id' => user['id'], 'screen_name' => user['screen_name'], 'name' => user['name'], 'image' => user['profile_image_url'], 'location' => user['location']}
this_user['status'] = user['status']['text'] unless user['status'].nil?
twitter_user_list.push this_user
end
twitter_user_list
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment