This pull request refactors the BatchApi gem to use a middleware system to process requests
using mitchellh's middleware gem.
The InternalMiddleware module provides a configurable stack that handles batch requests.
This happens in four parts (described in more detail in internal_middleware.rb):
1) Batch-wide middleware, which can act on the entire set of requests.
2) The processor kicks off the individual operations (currently sequential only).
3) Operation-specific middleware, which act on individual batch ops.
4) The executor, which actually calls onward in the Rack stack, executing the RESTful request.
This system allow users a lot more flexibility in how requests are processed. For instance:
No doubt other apps will have other specific needs that this system will address.
NOTE: I'd like to refactor the middleware into two stacks (batch and ops) rather than one; this will
be cleaner and more straightforward to work with. (I of course realized this as I wrote this PR.) That will
happen as a separate request.
Rename Rack middleware to RackMiddleware
One more file for renaming
Add InternalMiddleware system
Add middleware gem
Refactor Sequential processor into tested middleware
Move JSON decoding into a tested middleware
Create executor, which simply runs the operation
Incorporate the Executor into other files
Use the processor-defined strategy, don't hardcode Sequential
Switch the processor to using the middleware
Decoding is now its own module
Fix response spec
Responses should be returned in the middlewares as Rack arrays
Remove test for old option
Remove to_rack method, not needed
Update readme and version
Fix bug in tests
Merge branch 'refs/heads/ostruct' into middleware