In order to version an API I decided to try and follow what conventions I could. I decided to do something similar to Github and what’s talked about in Versioning Your APIs by setting the version in the headers ‘Accept’ param and putting ‘v1’ in the vnd suffix (is that what is called?).
Using Responders’ functionality that
ActionController::Responder makes use of, I created a custom responder to determine the version of the API during a request and using the decorator pattern (through the draper gem) to have different decorators for each version and each resource.
In the controllers:
Update (2 Oct., 2012)
This was presented at WNYRuby 2 Oct., 2012. Here are the slides.