API Version Mapper
About
In the same vein as Rack::URLMap or drnic’s probably versioned submission, API Version Mapper provides
a simple way to declare and namespace different api versions for a Rack app.
Usage
Due to the way it’s invoked, it is run as an api typically and not middleware (possibly using Rack::Cascade or the like to call it). For an example of actual code use, see example.ru in the code – you simple call Rack::APIVersionMapper#add_version with a number (e.g. 2) and a rack app to host that version of the api – SCRIPT_NAME and PATH_INFO are corrected as needed (so, PATH_INFO will be relative to that api in the app, e.g. /api/v1/users.json will show up with a SCRIPT_NAME of /api/v1 in the app and PATH_INFO of /users.json.
Unknown API versions 404 with a message, Unknown URLs simply 404 with an empty body (for apps like Rack::Cascade). See example.ru for more examples of usage
