Carlos Paramio
2008-Mar-24 19:12 UTC
[Facebooker-talk] Support for unparsed responses and json parser
This is my first message to the list. Hello everybody! I just wanted to let you know that I submitted a couple of patches for two features that you might find them of interest. The first one adds support for unparsed responses to Facebooker::Session and Facebooker::Service models. This allows to use the Facebooker::Session.post method to obtain a plain response from the Facebook API, useful for example for uncovered methods (like those for the new Data Store API), or complex responses to a FQL query, but still uses Facebooker for the parameters signature and the rest of logic. The option to parse or not can be modified in runtime, so you can use the same Facebook session object for any query, parsed or not. The patch is a diff of svn trunk at 18th Mar, and you can find it here, with usage examples: http://rubyforge.org/tracker/index.php?func=detail&aid=18910&group_id=4187&atid=16132 The second one is a preliminar support for a JSON parser that complements the XML parser, and that refactor the XML parser. The usage of one or the other is selectable at runtime. I found that JSON responses uses a lot less of bandwidth than the XML ones, and are easier to parse. Combined with the previous patch, the resulted JSON string for a query can be used directly on a view that contains some Javascript code, without needing to parse the response and then convert it to a string again to output it. I haven''t merged this patch with the previous one, by the way, in case that you consider this of interest but not the other. Again, the patch is a diff of svn trunk at 18th Mar, and you can find it here, with usage examples: http://rubyforge.org/tracker/index.php?func=detail&aid=18916&group_id=4187&atid=16132 I hope that any of them was useful for somebody. -- Carlos Paramio
Carlos Paramio
2008-Mar-24 19:40 UTC
[Facebooker-talk] Support for unparsed responses and json parser
Oh! I forgot to mention that you can find a better explanation and some examples of them at my blog, in case some of you are interested: http://evolve.st/posts/2-facebooker-gem-and-non-parseable-responses http://evolve.st/posts/5-a-json-parser-for-facebooker Carlos Paramio On Mon, Mar 24, 2008 at 8:12 PM, Carlos Paramio <carlosparamio at gmail.com> wrote:> This is my first message to the list. Hello everybody! > > I just wanted to let you know that I submitted a couple of patches for > two features that you might find them of interest. > > The first one adds support for unparsed responses to > Facebooker::Session and Facebooker::Service models. This allows to use > the > Facebooker::Session.post method to obtain a plain response from the > Facebook API, useful for example for uncovered methods (like those for > the new Data Store API), or complex responses to a FQL query, but > still uses Facebooker for the parameters signature and the rest of > logic. The option to parse or not can be modified in runtime, so you > can use the same Facebook session object for any query, parsed or not. > > The patch is a diff of svn trunk at 18th Mar, and you can find it > here, with usage examples: > > http://rubyforge.org/tracker/index.php?func=detail&aid=18910&group_id=4187&atid=16132 > > The second one is a preliminar support for a JSON parser that > complements the XML parser, and that refactor the XML parser. The > usage of one or the other is selectable at runtime. I found that JSON > responses uses a lot less of bandwidth than the XML ones, and are > easier to parse. Combined with the previous patch, the resulted JSON > string for a query can be used directly on a view that contains some > Javascript code, without needing to parse the response and then > convert it to a string again to output it. I haven''t merged this patch > with the previous one, by the way, in case that you consider this of > interest but not the other. > > Again, the patch is a diff of svn trunk at 18th Mar, and you can find > it here, with usage examples: > > http://rubyforge.org/tracker/index.php?func=detail&aid=18916&group_id=4187&atid=16132 > > I hope that any of them was useful for somebody. > -- > Carlos Paramio