roar / representable support

13 views
Skip to first unread message

nick.go...@gmail.com

unread,
Oct 20, 2014, 11:05:27 PM10/20/14
to praxis-de...@googlegroups.com
Roar based on roxml allows for easy json / xml to ruby object conversions and ruby to json / xml. It really a pretty good gem. It would allow for out of the box support for various types of data interchange

Sent from my iPhone

Josep Blanquer

unread,
Oct 23, 2014, 2:15:17 PM10/23/14
to Nick Gorbikoff, praxis-de...@googlegroups.com
Nick,

 The premise of our mediatypes and parameter/payload types in general is to work with "structure" representations, not format encodings.
In other words, everything internally is built to "load" and "render" type definitions into ruby hashes: hashes are the canonical internal representation of things. Nothing in the innards of the code assume or rely on JSON or any other format.

This means that it is only in the last moment that you'd want your "format" your rendered hash. Or only at the begining of a request that you want to "load" the incoming formatted message into a ruby hash.

On the output, if you like JSON for your APIs, you simply need to do JSON.dump( rendered_hash ) in the controller action... but you can as well feed the hash/array into any XML generator that can take incoming ruby hashes/arrays.
On the input side, that's a little more limited now. At the moment, Praxis will only be able to "load" payloads that are JSON encoded (and form-encoding) into the payload types. This means that it is not going to parse XML bodies. That can certainly be enhanced, and we should make it easy for you do add extra payload parsers (based on incoming content types). The plugin work that is coming soon should make that extension easier.

In terms of using Roar, (or its `representable` underlying gem) I don't quite see the benefit or how it would even work, as:
* I do think that the attributor syntax and type extensibility is much cleaner, easier and better (completely biased opinion :) )
* Like I said above, Praxis focuses in "structures" and not encodings...and those two things are built together in Roar.
* I "'"think""" (with triple quotes) that the performance of attributor is better...although this would require much more investigation and proof than me saying that.

 That's just my 2 cents about it,

Josep M.


On Mon, Oct 20, 2014 at 8:05 PM, <nick.go...@gmail.com> wrote:
Roar based on roxml allows for easy json / xml to ruby object conversions and ruby to json / xml. It really a pretty good gem. It would allow for out of the box support for various types of data interchange

Sent from my iPhone

--
You received this message because you are subscribed to the Google Groups "praxis-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to praxis-developm...@googlegroups.com.
To post to this group, send email to praxis-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/praxis-development/e5511855-daa3-4457-9f65-1c781687cc58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages