Class: BatchRequestApi::Middleware
- Inherits:
-
Object
- Object
- BatchRequestApi::Middleware
- Includes:
- BatchParallel, BatchSequential
- Defined in:
- lib/batch_request_api/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from BatchSequential
Methods included from BatchUtil
#build_response, #get_payload, #setup_env
Methods included from BatchParallel
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
10 11 12 |
# File 'lib/batch_request_api/middleware.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/batch_request_api/middleware.rb', line 14 def call(env) if env['PATH_INFO'] == '/api/v1/batch_sequential' batch_sequential(env) elsif env['PATH_INFO'] == '/api/v1/batch_parallel' batch_parallel(env) else @app.call(env) # regular RAILS CRUD end end |