Re: [ruby-99] Migrating to new FB graph API

From: ambert h.
Sent on: Tuesday, July 6, 2010 6:34 PM
And one more note that made my conversation easier - with Facebooker I often used facebook_session.fql_query and facebook_session.uid. This doesn't exactly map to RestGraph, which stores the uid in .data['uid'] and uses the method "fql" instead of "fql_query"

You can send it some modifications so you don't have to change your controller/model code

RestGraph.send("define_method", "uid", lambda {data['uid']})
RestGraph.send("define_method", "fql_query", lambda {|query| fql query})


Ambert


On Sat, Jul 3, 2010 at 7:24 PM, Paul Hepworth <[address removed]> wrote:
Thanks Ambert. As I migrate from facebooker I will consider these points.

Paul

On Jul 3, 2010, at 1:28 AM, ambert ho wrote:

Posted this to the SF Ruby list but thought I might share thoughts with the SV meetup in case anybody is wonder.

I migrated my app running Facebooker + the Authlogic FB connect plugin to the new FB api using this gem (http://github.com/cardinalblue/rest-graph) There are other gems for the task, and there's an Authlogic Oauth2 gem as well somewhere
http://github.com/nsanta/fbgraph, http://intridea.com/2010/4/22/oauth2-gem-just-in-time-for-facebook-graph

here's my thoughts for migrating from Facebooker:
  • Rest-graph has functions for retrieving the access token that the new graph API uses, as well as converting a session key to an access token, but the FB.login function from the new javascript API already takes care of generating the access token so you can just use that, and then directly pass that to rest-graph
  • If you were using Facebooker before, and thus using set_facebook_session to retrieve session[:facebook_session], you can pretty much transition easily by implementing your own set_facebook_session method in the application controller that retrieves/constructs a rest-graph instance
  • Also with migrating from Facebooker, I made set_facebook_session still return @facebook_session as a Rest-Graph instance, so that I reuse the syntax from before, except switching out facebook_session.fql_query() for facebook_session.fql() (the rest-graph syntax), and all the "facebook_session.user" stuff to retrieve personal information from Facebooker becomes facebook_session.get('<graph API statement>')





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by ambert ho ([address removed]) from Silicon Valley Ruby Meetup.
To learn more about ambert ho, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Paul Hepworth ([address removed]) from Silicon Valley Ruby Meetup.
To learn more about Paul Hepworth, visit his/her member profile

To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy