facebookrb
Facebookrb is currently a work in progress. It aims to be a lightweight yet fully featured client for the [Facebook API](wiki.developers.facebook.com/index.php/API). It is mostly based on MiniFB (github.com/appoxy/mini_fb) and includes some features inspired by rack-facebook (github.com/carlosparamio/rack-facebook). In other instances, it emulates the official Facebook PHP library.
Installation
gem install facebookrb
General Usage
require ‘facebookrb’
You will want to create a client to make calls to Facebook
fb_client = FacebookRb::Client.new("API_KEY", "SECRET")
If you are using the middleware, there will be one created for you already, available in ‘env`.
user_hash = fb_client.call("Users.getInfo", "session_key"=>@session_key, "uids"=>@uid, "fields"=>User.all_fields)
Which simply returns the parsed json response from Facebook. The client will ask for results in JSON by default.
Middleware
The middleware checks the signature of Facebook params, and stores them in env.
require 'facebookrb'
use Rack::Facebook, :api_key => "APIKEY", :secret => "SECRET"
The Facebook parameters in the request are stored in ‘env` and `env.fb_params` if the request is valid (wiki.developers.facebook.com/index.php/Verifying_The_Signature)
Planned Features
* Facebook Connect
* Batching (http://wiki.developers.facebook.com/index.php/Using_Batching_API)
* Base domain (http://wiki.developers.facebook.com/index.php/Base_Domain)
* Preload FQL (http://wiki.developers.facebook.com/index.php/Preload_FQL)
* Permissions API (http://wiki.developers.facebook.com/index.php/Permissions_API)
* Session Secret (http://wiki.developers.facebook.com/index.php/Session_Secret)
* Converting the request method from the Facebook POST to the original HTTP method used by the client. (http://wiki.developers.facebook.com/index.php/Fb_sig_request_method)