GitXplorerGitXplorer
j

rack-batch

public
6 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
e80d26200d78e67afa4a16206a61a4f3f8cc5556

deprecate

jjtarchie committed 10 years ago
Unverified
2d77874d3c8fa9c94d261ef8eb95ec6eb626e343

changed GET to POST

jjtarchie committed 12 years ago
Unverified
eadcac59eaa3e4822e283e3228b1279d2370fdce

remove idea directory

jjtarchie committed 12 years ago
Unverified
c0660ed8ba3a6a425f8fd59d692ddf2072f377d2

update README

jjtarchie committed 12 years ago
Unverified
8f6df21ab877311a2d30fc08e647b68c5d599b93

include examples

jjtarchie committed 12 years ago
Unverified
e64afe20c06208b0cf1fe81cfdd6f7d815f40efb

use a POST body with JSON

jjtarchie committed 12 years ago

README

The README file for this repository.

Deprecated

For better example, please use batch_api

Rack::Batch

This gem allows multiple requests to be batch into a single request. This can be handy when doing API calls from mobile devices with a slow connection.

Installation

Add this line to your application's Gemfile:

gem 'rack-batch', require: "rack/batch"

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-batch

...

require "rack/batch"

Usage

In a Rack config.ru file somewhere:

use Rack::Batch, {endpoint: '/secret_batch', limit: 10}

run MyRackApp

Now when a user POSTs /secret_batch endpoint then can make a request with multiple requests (no more than 10). All requests are passed through the ops param.

Example

Please look at the examples/ folder for usage.

Options

Rack::Batch can take several options as a hash argument.

  • endpoint
  • limit
  • encode_json

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request