1

I am re-factoring a component service of an application, which is a JSON-over-HTTP microservice. The client and server are both Ruby.

Ideally the re-factored client code will produce model objects interchangeable with ORM objects from Sequel ORM, so that consumers of the higher-level model can be agnostic on what the data source/backing is.

I could write something based around rest-client but am wondering if someone else has already solved this. When I search for "ruby rest client like backbone" I get tons of results for using Ruby/Rails with Backbone, so I am finding it hard to tell whether such a model-based RESTful client framework exists.

Desired features:

  • Open-source Ruby gem.

  • Consumes REST(ful) services and supports representation of them as a data model.

    • No need for clever consumption of interface-defining URIs
  • DSL or declarative syntax for relationships between entities (probably the feature of backbone I'd like to replicate).

    • I am assuming that I have to write model code for each class, with a simple declarative-style DSL covering which fields to expose, how the object is read/written and how each relation needs to be followed according to the properties of the RESTful service.
  • Simple caching/memoisation to prevent repeated requests when the client already has relevant data.

  • Lightweight. Only has to cover simple basic relationships itself and allow custom methods when that is not possible.

    • Dependencies on e.g. rest-client are fine.

    • I have ruled out using a DataMapper model and DataMapper adaptors on this basis, and because the rest of the target application is moving to Sequel ORM.


Update:

Browsing rubygems, I have found restfully, rest-core, rest_model and arrest. Although the last one seems quite light on documentation, they all seem to promise some of what I am looking for. Any experience or enlightenment on which best matches my requirements would be much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.