Service-Oriented Design with Ruby and Rails (Addison-Wesley Professional Ruby)

Author: Paul Dix
4.2
All Stack Overflow 9

Comments

by anonymous   2017-08-20

Brandon Hilkert has been doing some posts about this topic. You can check them out here. There are also some books available on Amazon like this one. StichFix also created a gem to somewhat assist in this.

by anonymous   2017-08-20

In few words – an a very practical, non academic explanation – a RESTful web service is a web server that answer requests that are structured following a :resource/:action/[:id] pattern.

For example, your users are a resource and you have these actions:

  • GET /users : list of users
  • GET /users/5000/edit : Edit a specific user
  • GET /users/5000 : Show a specific user
  • GET /users/new : Form for creating a new user
  • POST /users/ : A post request that created a new user.
  • PUT /users/5000 : A Post request that updates an user.
  • DELETE /users/5000 : A destroy request that removes an user.

It is a CRUD interface: Create, Read, Update, Destroy.

Your sessions are resources too.

  • POST /session/create : Create a new session for a user.
  • DELETE /session/destroy : Removes a session.

Some resources do not need to be have all CRUD actions.

For the original document that describes the RESTful architecture:

http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

For a more practical examination of this matter:

http://www.amazon.com/Service-Oriented-Design-Rails-Addison-Wesley-Professional/dp/0321659368

by anonymous   2017-08-20

I recently found myself pondering similar questions, how best to modularise a large application. As a relative Ruby newcomer (< a year), I dabbled with writing Rails APIs, and consuming them with ActiveResource. It didn't feel quite right to me, Rails felt too bloated for the APIs and ActiveResource felt too generic and incomplete for the client.

Then, I read Service Oriented Design with Ruby and Rails - Paul Dix, and it was like an epiphany! It covers your specific question of pros, cons & the theory very early on (chapter 1 I think), and does it very well.