Skip to content

Instantly share code, notes, and snippets.

@bigfatgreg
Created October 10, 2012 21:37
Show Gist options
  • Save bigfatgreg/3868606 to your computer and use it in GitHub Desktop.
Save bigfatgreg/3868606 to your computer and use it in GitHub Desktop.
rake task for making facebook test users friends with each other
task :make_friends => :environment do
# uses the fb_graph gem to talk to facebook
token = FbGraph::Application.new(AUTH_PARAMS[:facebook_id], :secret => AUTH_PARAMS[:facebook_secret]).get_access_token
link = JSON.parse(open(URI.escape("https://graph.facebook.com/#{AUTH_PARAMS[:facebook_id]}/accounts/test-users?access_token=#{token}")).read)
link['data'].each do |r|
link_beg = "https://graph.facebook.com/" + r['id'] + "/friends/"
link_end = "?method=post&access_token=" + r['access_token']
link['data'].each { |link| Curl.get(link_beg + link['id'] + link_end) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment