nimble_throttler 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -6
  3. data/nimble_throttler.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0765993522990a60372512a6c8c7a17cef2ca2cb
4
- data.tar.gz: 75c2ea0f82ed30ec40327bf01cf3a9aafe5e0eac
3
+ metadata.gz: eef8af63d28977c1fabe218bfb3ef8e8540d6077
4
+ data.tar.gz: f88fdf87edd68648fc19f89e4ff804aa112e3259
5
5
  SHA512:
6
- metadata.gz: afffca9f47aba0c0da8c34de7aeeb19aacf5e8b82635cccdb6e533e1a7257b2f7740d6d8b3788d0bdcb50c010fad4a5d6fe364f2ef8f8831a19895b40e2f1f0d
7
- data.tar.gz: 19368f26a8dd02ab07ea41e2f1727a01e9e22b5361da73e84ecf2d60c50f632721292cc6ff08d694b575f2ba4d40ea06f44744baae935531a49b4465102cbf89
6
+ metadata.gz: 4290b99ac2c6864ee2ed4ac73df1b894a3712a90d5482266274266e93832ab792ffc4cc451f14ac94029513086bf3e9a3e160ce2defe3c4855beb595167d143f
7
+ data.tar.gz: 069c804c85e28fc4007fd1a7bb4d7952deb1ad118f2eea204f54f8195e75b119d989e091f38ba1ad9bb599919245d3a8ae508aa14ea5d321a6817b48e7b27398
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # NimbleThrottler
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nimble_throttler`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Code Climate](https://codeclimate.com/github/kimquy/nimble_throttler/badges/gpa.svg)](https://codeclimate.com/github/kimquy/nimble_throttler)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ [![Build Status](https://travis-ci.org/kimquy/nimble_throttler.svg?branch=master)](https://travis-ci.org/kimquy/nimble_throttler)
6
+
7
+ NimbleThrottler is very simple ruby gem which allow throttling an certain endpoints.
6
8
 
7
9
  ## Installation
8
10
 
@@ -22,13 +24,27 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ Add the following code into `application.rb` of your Rails app.
28
+
29
+ ```ruby
30
+ require "nimble_throttler"
26
31
 
27
- ## Development
32
+ module YourRailsApp
33
+ class Application < Rails::Application
34
+ config.middleware.use Rack::NimbleThrottling
35
+ end
36
+ end
37
+ ```
28
38
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+ Now you're ready to throttle the endpoints by adding this file `nimble_throttling.rb` into `initializers` folder. Example:
30
40
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+ ```ruby
42
+ NimbleThrottler.configure do
43
+ throttle '/testing', limit: 5, period: 1.hours
44
+ throttle '/awesome', limit: 100, period: 2.hours
45
+ throttle '/home/page', limit: 100, period: 3.hours
46
+ end
47
+ ```
32
48
 
33
49
  ## Contributing
34
50
 
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "nimble_throttler"
8
- spec.version = "0.0.2"
8
+ spec.version = "0.0.3"
9
9
  spec.authors = ["Long Nguyen"]
10
10
  spec.email = ["long.polyglot@gmail.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimble_throttler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Long Nguyen