Created
July 3, 2012 15:52
-
-
Save cgallagher/3040622 to your computer and use it in GitHub Desktop.
Script for pushing out loads of actions in order to see how your Open Graph actions scale out.
This file contains hidden or 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
require 'rubygems' | |
require "net/http" | |
require "net/https" | |
require "uri" | |
access_token = "" #App Access Token (app_id|app_secret) | |
user_id = "" #FBID of an app user who has granted perms to publish actions within your app | |
og_object_url = "http://dby-staging.herokuapp.com/og/84" #url to the OG data to be pushed along with your user | |
og_object_type = "design" #object name | |
og_namespace = "dbystaging" #application namespace | |
og_action = "submit" #action name in dev app | |
http = Net::HTTP.new('graph.facebook.com', 443) | |
http.use_ssl = true | |
path = "/#{user_id}/#{og_namespace}:#{og_action}" | |
data = "#{og_object_type}=#{og_object_url}&access_token=#{access_token}" | |
headers = {'Content-Type'=> 'application/x-www-form-urlencoded'} | |
num_actions = 10 | |
num_actions.times do |i| | |
puts "creating action #{data}" | |
resp = http.post(path, data, headers) | |
puts 'Code = ' + resp.code | |
puts "RESPONSE => #{resp.body}" | |
sleep 2.0 | |
end | |
puts "now visit http://www.facebook.com/YOUR_USERNAME/app_#{og_namespace} to see app actions" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment