Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add installation section to the readme

  • Loading branch information...
commit 66f967036dd492935492871842e57ef1ba549c80 1 parent 2714851
@arsduo authored
Showing with 52 additions and 28 deletions.
  1. +31 −28 Gemfile.lock
  2. +21 −0 readme.md
View
59 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- batch_api (0.2.0)
+ batch_api (0.2.1)
middleware
GEM
@@ -35,41 +35,47 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
- builder (3.0.0)
+ builder (3.0.4)
+ coderay (1.0.8)
columnize (0.3.6)
- debugger (1.2.0)
+ debugger (1.2.1)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
- debugger-ruby_core_source (~> 1.1.3)
+ debugger-ruby_core_source (~> 1.1.4)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
- debugger-ruby_core_source (1.1.3)
+ debugger-ruby_core_source (1.1.4)
diff-lcs (1.1.3)
erubis (2.7.0)
- faker (1.0.1)
- i18n (~> 0.4)
- ffi (1.1.5)
- guard (1.3.2)
+ faker (1.1.2)
+ i18n (~> 0.5)
+ guard (1.5.0)
listen (>= 0.4.2)
+ lumberjack (>= 1.0.2)
+ pry (>= 0.9.10)
thor (>= 0.14.6)
- guard-rspec (1.2.1)
+ guard-rspec (2.1.0)
guard (>= 1.1)
+ rspec (~> 2.11)
hike (1.2.1)
- i18n (0.6.0)
+ i18n (0.6.1)
journey (1.0.4)
- json (1.7.4)
- listen (0.4.7)
- rb-fchange (~> 0.0.5)
- rb-fsevent (~> 0.9.1)
- rb-inotify (~> 0.8.8)
+ json (1.7.5)
+ listen (0.5.3)
+ lumberjack (1.0.2)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
+ method_source (0.8.1)
middleware (0.1.0)
mime-types (1.19)
multi_json (1.3.6)
polyglot (0.3.3)
+ pry (0.9.10)
+ coderay (~> 1.0.5)
+ method_source (~> 0.8)
+ slop (~> 3.3.1)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
@@ -79,7 +85,7 @@ GEM
rack
rack-ssl (1.3.2)
rack
- rack-test (0.6.1)
+ rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.8)
actionmailer (= 3.2.8)
@@ -97,11 +103,7 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
- rb-fchange (0.0.5)
- ffi
- rb-fsevent (0.9.1)
- rb-inotify (0.8.8)
- ffi (>= 0.5.0)
+ rb-fsevent (0.9.2)
rdoc (3.12)
json (~> 1.4)
rspec (2.11.0)
@@ -109,19 +111,20 @@ GEM
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
- rspec-expectations (2.11.2)
+ rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
- rspec-mocks (2.11.2)
- rspec-rails (2.11.0)
+ rspec-mocks (2.11.3)
+ rspec-rails (2.11.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
ruby_gntp (0.3.4)
- sinatra (1.3.2)
+ sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
+ slop (3.3.3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -129,8 +132,8 @@ GEM
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
- timecop (0.4.5)
- treetop (1.4.10)
+ timecop (0.5.3)
+ treetop (1.4.11)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
View
21 readme.md
@@ -91,6 +91,27 @@ same status code and body they would return as individual requests.
If the Batch API itself returns a non-200 status code, that indicates a global
problem.
+## Installation
+
+Setting up the Batch API is simple. Just add the gem to your middlewares:
+
+```ruby
+# in application.rb
+config.middleware.use BatchApi::RackMiddleware do |batch_config|
+ # you can set various configuration options:
+ batch_config.verb = :put # default :post
+ batch_config.endpoint = "/batchapi" # default /batch
+ batch_config.limit = 100 # how many operations max per request, default 50
+
+ # default middleware stack run for each batch request
+ batch_config.batch_middleware = Proc.new { }
+ # default middleware stack run for each individual operation
+ batch_config.operation_middleware = Proc.new { }
+end
+```
+
+That's it! Just fire up your curl, hit your endpoint with the right verb and a properly formatted request, and enjoy some batch API action.
+
## Why a Batch API?
Batch APIs, though unRESTful, are useful for reducing HTTP overhead
Please sign in to comment.
Something went wrong with that request. Please try again.