nov/fb_graph — pull request #243 by kellym (2012-06-18 16:18:35+00:00)
Title: Batch mode

This should help continue the development on batch requests. I did preliminary tests with `og_action!` and found it working decently well, and running a test on the `friends` method seemed to perform too.

The main problem is when an action needs to be run inside a batch request, before that request is performed (i.e. fetch.namespace). That action can't run since we're already set up to queue these actions.

This adds the ability to handle the response in a block after each individual action, but it also returns all the data at the end as well. For instance:

```ruby
FbGraph.batch do
facebook_user.og_action! 'my_app.host', :party => 'http://myhouse.com' do |response, status|
Action.create(:cancellation_id => response.identifier) if status == :success
end
end
```

`FbGraph.batch` also returns all the responses in an array in case you need to perform another set of batch requests with them. For instance, I perform a batch of open graph actions, then use the returned ID of each to perform another batch job to get the details of those actions.

It would be nice if there were a way to perform non-batch requests inside the batch block, especially requests that are performed inside FbGraph's code (like retrieving the namespace for open graph tags). Might just be a matter of creating another flag like `:batch => false`.