README.md in grape-batch-1.2.1 vs README.md in grape-batch-2.0.0
- old
+ new
@@ -46,11 +46,10 @@
Grape::Batch.configure do |config|
config.limit = 10
config.path = '/batch'
config.formatter = Grape::Batch::Response
config.logger = nil
- config.session_header = 'HTTP_X_SESSION_TOKEN'
config.session_proc = Proc.new {}
end
```
| Argument | Type | Default | Description
@@ -99,16 +98,15 @@
```
'body' is optional.
### Sessions
-It's possible ensure a single session during the execution of the batch. You have to specify your session/token/auth header and your session Proc. Before running the batch, the Proc is executed with the data extracted from the specified session header and stored in rack env 'api.session' key.
+It's possible ensure a single session during the execution of the batch. You have to specify your session Proc. Before running the batch, the Proc is executed (with env as argument) and stored in rack env 'api.session' key.
```ruby
# Example
# Considering the config
Grape::Batch.configure do |config|
- config.session_header = 'HTTP_X_SESSION_TOKEN'
- config.session_proc = Proc.new {|token| User.where(token: token).first }
+ config.session_proc = Proc.new {|env| User.where(token: env['HTTP_X_TOKEN']).first }
end
# You can build a Grape helper like this
module AuthHelpers
def current_user