Representable 1.7 // Representable instead of Roar?

71 views
Skip to first unread message

JP Slavinsky

unread,
Nov 27, 2013, 1:16:38 PM11/27/13
to roar...@googlegroups.com
Howdy - just found Roar yesterday and it looks pretty cool (so nice to think "man I wish there were a gem to do bidrectional API stuff" and bam there it is!).

I was just coding up an API PUT/update method when I ran into a problem with Roar trying to make new records for records that already exist.  Then I found Nick's blog post talking about Representable 1.7's ":parse_strategy => :sync" which gets around this problem (http://nicksda.apotomo.de/2013/08/representable-1-7-is-out-with-syncing-support-inline-representers-and-more/).

Unfortunately, roar and roar-rails appear to use Representable 1.6.

So two questions:
  1. Any chance that versions of roar and roar-rails using representable 1.7 can be released? (this may be a non-trivial thing of course)
  2. Should I just use Representable directly instead of Roar?  Looking at representable, I don't quite understand what the differences are between the two.  Or maybe I don't understand what a "real" REST API really is :-)
Thanks! JP


Andrés Freyría

unread,
Nov 27, 2013, 1:46:12 PM11/27/13
to roar...@googlegroups.com
Hi JP,

I also needed to use Representable 1.7, so I forked and changed the dependency for now: https://github.com/andresf/roar/tree/representable-1.7 . Feel free to point your Gemfile there. Since the jump from 1.6 to 1.7 could break stuff for other users, Nick has not yet updated the master branch. I personally have not encountered any problems (yet), but YMMV.

From my point of view, Representable is a gem that allows ruby objects to turn into different formats, and Roar builds on top of that to address APIs specifically. In particular, there's support for hypermedia-aware formats like Collection+JSON and application/hal+json, and some nice features for building clients as well.

Cheers,


Andrés Freyría Cedeño


2013/11/27 JP Slavinsky <j...@kindlinglabs.com>

--
You received this message because you are subscribed to the Google Groups "Roar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to roar-talk+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

JP Slavinsky

unread,
Nov 27, 2013, 4:25:13 PM11/27/13
to roar...@googlegroups.com
Thanks!

Nick Sutterer

unread,
Nov 27, 2013, 5:44:46 PM11/27/13
to roar...@googlegroups.com
Sorry guys, I forgot to update the dependencies. You can use 1.6 or 1.7 with roar, it's up to you. I didn't realize it's

 s.add_runtime_dependency "representable", "~> 1.6.0"

Doesn't make sense to use the sperm operator here :)

JP- Roar is really just a thin layer on top of representable - it gives you a bit of DSL sugar for APIs, but that's about it. I am rewriting the Roar README (this time, for real!) which points that out.

Cheers


Nick Sutterer

unread,
Nov 27, 2013, 5:48:31 PM11/27/13
to roar...@googlegroups.com
Successfully registered gem: roar (0.12.1)

Andrés Freyría

unread,
Nov 27, 2013, 5:53:35 PM11/27/13
to roar...@googlegroups.com
Aaaand we're back to the main branch <3


Andrés Freyría Cedeño


2013/11/27 Nick Sutterer <apot...@gmail.com>

Nick Sutterer

unread,
Nov 27, 2013, 5:54:42 PM11/27/13
to roar...@googlegroups.com
Dude, I told you if you need anything, just let me know!!!!!!!!!111oneoneeleven
Reply all
Reply to author
Forward
0 new messages