Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (44 sloc) 2.06 KB


Ruby Facebook Graph API Wrapper

A simple Ruby wrapper to help use the Facebook Graph API.

Documentation on the Graph API is available here: [](

This code is based off of the Python SDK - [](


gem install rfgraph


Without auth token

require 'rfgraph'
req =
req.get_object("331218348435", :metadata => 1)

With auth token

require 'rfgraph'
fauth =, APP_SECRET)

# Get the URL to redirect your user to in their web browser.
# For options see:
# For scope permissions see:
auth_url = fauth.authorize_url("", :display => :popup, :scope => [])

# Get the code that facebook returns after the user auths your app and turn that into a auth token
# Make sure that the callback url is the same as in the previous request, otherwise the request will fail
auth_token = fauth.authorize("", FACEBOOK_CODE)

# Make some requests using the auth token
request =

request.put_wall_post("Awesome message!")

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Copyright © 2010 Conor Hunt <> Released under the MIT license