Project

rfgraph

0.01
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for Facebook Graph API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.2.4
 Project Readme

Ruby Facebook Graph API Wrapper

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

Documentation on the Graph API is available here: http://developers.facebook.com/docs/

This code is based off of the Python SDK - http://github.com/facebook/python-sdk/

Install

gem install rfgraph

Example

Without auth token

require 'rfgraph'
req = RFGraph::Request.new
req.get_object("19292868552")
req.get_object("99394368305/photos")
req.get_object("331218348435", :metadata => 1)

With auth token

require 'rfgraph'
fauth = RFGraph::Auth.new(APP_ID, APP_SECRET)

# Get the URL to redirect your user to in their web browser.
# For options see: http://developers.facebook.com/docs/authentication/
# For scope permissions see: http://developers.facebook.com/docs/authentication/permissions
auth_url = fauth.authorize_url("http://yourwebsite.com/callback", :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("http://yourwebsite.com/callback", FACEBOOK_CODE)

# Make some requests using the auth token
request = RFGraph::Request.new(auth_token)
request.get_object("me")
request.get_object("me/friends")

request.put_wall_post("Awesome message!")

COPYRIGHT

Copyright (c) 2010 Conor Hunt conor.hunt@gmail.com Released under the MIT license