Created
October 10, 2012 21:37
-
-
Save bigfatgreg/3868606 to your computer and use it in GitHub Desktop.
rake task for making facebook test users friends with each other
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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