Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Add example to README.

  • Loading branch information...
commit 5d464fae1cf75ad677343684a932275c1d387c5d 1 parent 099fe73
@benbjohnson authored
Showing with 28 additions and 2 deletions.
  1. +28 −2
@@ -23,12 +23,38 @@ To install Slow Web, simply install the gem:
And specify the domain to limit.
require 'slowweb'
- SlowWeb.limit('', 10, 60)
+ SlowWeb.limit('', 10, 60)
-This restricts the `` domain to only allowing `10` requests every
+This restricts the `` domain to only allowing `10` requests every
`60` seconds.
+Because SlowWeb attaches to the low-level Net::HTTP class, all API gems should
+work. For example, you can use the [Octopi](
+API to access GitHub information and use SlowWeb to restrict calls
+ require 'slowweb'
+ SlowWeb.limit('', 60, 60) # 60 requests per minute
+ # Use up all the API requests for this minute
+ 60.times do |i|
+ tpw = Octopi::User.find('mojombo')
+ end
+ # This request will wait until a minute after the first request was sent
+ wanstrath = Octopi::User.find('defunkt')
+This code will retrieve user information on
+[Tom Preston-Warner (mojombo)]( sixty times and then
+attempts to access user information for
+[Chris Wanstrath (defunkt)]( However when the API
+call is made to view `defunkt`, SlowWeb will cause your application sleep until
+a minute has passed since your first request to mojombo.
If you'd like to contribute to SlowWeb, start by forking the repository

0 comments on commit 5d464fa

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