Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add installation section to the readme

  • Loading branch information...
commit 66f967036dd492935492871842e57ef1ba549c80 1 parent 2714851
Alex Koppel authored October 22, 2012

Showing 2 changed files with 52 additions and 28 deletions. Show diff stats Hide diff stats

  1. 59  Gemfile.lock
  2. 21  readme.md
59  Gemfile.lock
... ...
@@ -1,7 +1,7 @@
1 1
 PATH
2 2
   remote: .
3 3
   specs:
4  
-    batch_api (0.2.0)
  4
+    batch_api (0.2.1)
5 5
       middleware
6 6
 
7 7
 GEM
@@ -35,41 +35,47 @@ GEM
35 35
       i18n (~> 0.6)
36 36
       multi_json (~> 1.0)
37 37
     arel (3.0.2)
38  
-    builder (3.0.0)
  38
+    builder (3.0.4)
  39
+    coderay (1.0.8)
39 40
     columnize (0.3.6)
40  
-    debugger (1.2.0)
  41
+    debugger (1.2.1)
41 42
       columnize (>= 0.3.1)
42 43
       debugger-linecache (~> 1.1.1)
43  
-      debugger-ruby_core_source (~> 1.1.3)
  44
+      debugger-ruby_core_source (~> 1.1.4)
44 45
     debugger-linecache (1.1.2)
45 46
       debugger-ruby_core_source (>= 1.1.1)
46  
-    debugger-ruby_core_source (1.1.3)
  47
+    debugger-ruby_core_source (1.1.4)
47 48
     diff-lcs (1.1.3)
48 49
     erubis (2.7.0)
49  
-    faker (1.0.1)
50  
-      i18n (~> 0.4)
51  
-    ffi (1.1.5)
52  
-    guard (1.3.2)
  50
+    faker (1.1.2)
  51
+      i18n (~> 0.5)
  52
+    guard (1.5.0)
53 53
       listen (>= 0.4.2)
  54
+      lumberjack (>= 1.0.2)
  55
+      pry (>= 0.9.10)
54 56
       thor (>= 0.14.6)
55  
-    guard-rspec (1.2.1)
  57
+    guard-rspec (2.1.0)
56 58
       guard (>= 1.1)
  59
+      rspec (~> 2.11)
57 60
     hike (1.2.1)
58  
-    i18n (0.6.0)
  61
+    i18n (0.6.1)
59 62
     journey (1.0.4)
60  
-    json (1.7.4)
61  
-    listen (0.4.7)
62  
-      rb-fchange (~> 0.0.5)
63  
-      rb-fsevent (~> 0.9.1)
64  
-      rb-inotify (~> 0.8.8)
  63
+    json (1.7.5)
  64
+    listen (0.5.3)
  65
+    lumberjack (1.0.2)
65 66
     mail (2.4.4)
66 67
       i18n (>= 0.4.0)
67 68
       mime-types (~> 1.16)
68 69
       treetop (~> 1.4.8)
  70
+    method_source (0.8.1)
69 71
     middleware (0.1.0)
70 72
     mime-types (1.19)
71 73
     multi_json (1.3.6)
72 74
     polyglot (0.3.3)
  75
+    pry (0.9.10)
  76
+      coderay (~> 1.0.5)
  77
+      method_source (~> 0.8)
  78
+      slop (~> 3.3.1)
73 79
     rack (1.4.1)
74 80
     rack-cache (1.2)
75 81
       rack (>= 0.4)
@@ -79,7 +85,7 @@ GEM
79 85
       rack
80 86
     rack-ssl (1.3.2)
81 87
       rack
82  
-    rack-test (0.6.1)
  88
+    rack-test (0.6.2)
83 89
       rack (>= 1.0)
84 90
     rails (3.2.8)
85 91
       actionmailer (= 3.2.8)
@@ -97,11 +103,7 @@ GEM
97 103
       rdoc (~> 3.4)
98 104
       thor (>= 0.14.6, < 2.0)
99 105
     rake (0.9.2.2)
100  
-    rb-fchange (0.0.5)
101  
-      ffi
102  
-    rb-fsevent (0.9.1)
103  
-    rb-inotify (0.8.8)
104  
-      ffi (>= 0.5.0)
  106
+    rb-fsevent (0.9.2)
105 107
     rdoc (3.12)
106 108
       json (~> 1.4)
107 109
     rspec (2.11.0)
@@ -109,19 +111,20 @@ GEM
109 111
       rspec-expectations (~> 2.11.0)
110 112
       rspec-mocks (~> 2.11.0)
111 113
     rspec-core (2.11.1)
112  
-    rspec-expectations (2.11.2)
  114
+    rspec-expectations (2.11.3)
113 115
       diff-lcs (~> 1.1.3)
114  
-    rspec-mocks (2.11.2)
115  
-    rspec-rails (2.11.0)
  116
+    rspec-mocks (2.11.3)
  117
+    rspec-rails (2.11.4)
116 118
       actionpack (>= 3.0)
117 119
       activesupport (>= 3.0)
118 120
       railties (>= 3.0)
119 121
       rspec (~> 2.11.0)
120 122
     ruby_gntp (0.3.4)
121  
-    sinatra (1.3.2)
  123
+    sinatra (1.3.3)
122 124
       rack (~> 1.3, >= 1.3.6)
123 125
       rack-protection (~> 1.2)
124 126
       tilt (~> 1.3, >= 1.3.3)
  127
+    slop (3.3.3)
125 128
     sprockets (2.1.3)
126 129
       hike (~> 1.2)
127 130
       rack (~> 1.0)
@@ -129,8 +132,8 @@ GEM
129 132
     sqlite3 (1.3.6)
130 133
     thor (0.16.0)
131 134
     tilt (1.3.3)
132  
-    timecop (0.4.5)
133  
-    treetop (1.4.10)
  135
+    timecop (0.5.3)
  136
+    treetop (1.4.11)
134 137
       polyglot
135 138
       polyglot (>= 0.3.1)
136 139
     tzinfo (0.3.33)
21  readme.md
Source Rendered
@@ -91,6 +91,27 @@ same status code and body they would return as individual requests.
91 91
 If the Batch API itself returns a non-200 status code, that indicates a global
92 92
 problem.
93 93
 
  94
+## Installation
  95
+
  96
+Setting up the Batch API is simple.  Just add the gem to your middlewares:
  97
+
  98
+```ruby
  99
+# in application.rb
  100
+config.middleware.use BatchApi::RackMiddleware do |batch_config|
  101
+  # you can set various configuration options:
  102
+  batch_config.verb = :put # default :post
  103
+  batch_config.endpoint = "/batchapi" # default /batch
  104
+  batch_config.limit = 100 # how many operations max per request, default 50
  105
+
  106
+  # default middleware stack run for each batch request
  107
+  batch_config.batch_middleware = Proc.new { }
  108
+  # default middleware stack run for each individual operation
  109
+  batch_config.operation_middleware = Proc.new { }
  110
+end
  111
+```
  112
+
  113
+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.
  114
+
94 115
 ## Why a Batch API?
95 116
 
96 117
 Batch APIs, though unRESTful, are useful for reducing HTTP overhead

0 notes on commit 66f9670

Please sign in to comment.
Something went wrong with that request. Please try again.