grape-attack 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff307dec592ab729847359d3da1bbdfe624136b5
4
- data.tar.gz: f20eff73c56b429c680a71a2db4a0cd7d53fd6f6
3
+ metadata.gz: ee757dc7311cc135e48839d5e228900fab226271
4
+ data.tar.gz: 2343ed24b75459ac14d697212a3d9fe1c8f9f4b4
5
5
  SHA512:
6
- metadata.gz: 8639ff18ef9e6d2a6123079bcd9071030e2bb5ee5d22056207ed48c01c4aa16667d4cde4ac74e1e175acf07ef69a2779b979d9afb3b2be4ace12f5af46c0b82a
7
- data.tar.gz: b8849164cda638b09ea9e41fcad405778411096b6ca06876bee7983be090332f00b2710134b077d81a311230c5bf47bc52f64a2537d1e428c3c32fe0ecb3d3a2
6
+ metadata.gz: cc36b636056eb80d9bb66d36a91e8f9f60e1e023f19e2f4d84d4388a5086ff803f40d7273286fa36fec80b54de1a998162780a3e6feee68affd79bea90383b93
7
+ data.tar.gz: 043ab9c157d553489a1a62d6713864e68bddf9e11694b07fcea277dbbfac21a52323eeba065ffde61f0b148882621062539591567ed61c3c110eb5aa64b341b9
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.1.1
2
+
3
+ * Support X-Real-IP for when behind loadbalancer [https://github.com/gottfrois/grape-attack/pull/3](https://github.com/gottfrois/grape-attack/pull/3)
data/README.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  A middleware for Grape to add endpoint-specific throttling.
6
6
 
7
+ ## Why
8
+
9
+ You are probably familiar with [Rack::Attack](https://github.com/kickstarter/rack-attack) which does a great job. Grape::Attack was built with simplicity in mind. It was also built to be used directly in [Grape](https://github.com/ruby-grape/grape) APIs without any special configurations.
10
+
11
+ It comes with a little DSL that allows you to protect your Grape API endpoints. It also automaticaly sets custom HTTP headers to let your clients know how much requests they have left.
12
+
13
+ If you need more advanced feature like black and white listing, you should probably use [Rack::Attack](https://github.com/kickstarter/rack-attack). But if you simply want to do API throttling for each of your Grape endpoints, go ahead and continue reading.
14
+
7
15
  ## Installation
8
16
 
9
17
  Add this line to your application's Gemfile:
@@ -22,7 +22,7 @@ module Grape
22
22
  end
23
23
 
24
24
  def client_identifier
25
- context.instance_eval(&throttle_options.identifier) || env['REMOTE_ADDR']
25
+ context.instance_eval(&throttle_options.identifier) || env['HTTP_X_REAL_IP'] || env['REMOTE_ADDR']
26
26
  end
27
27
 
28
28
  def throttle?
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Attack
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-attack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Louis Gottfrois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-02 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
@@ -118,6 +118,7 @@ files:
118
118
  - .gitignore
119
119
  - .rspec
120
120
  - .travis.yml
121
+ - CHANGELOG.md
121
122
  - Gemfile
122
123
  - LICENSE.txt
123
124
  - README.md