grape-attack 0.1.1 → 0.2.0

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: ee757dc7311cc135e48839d5e228900fab226271
4
- data.tar.gz: 2343ed24b75459ac14d697212a3d9fe1c8f9f4b4
3
+ metadata.gz: 57fc46d111b5ae7aea4b21aae9ed2a93e48ab843
4
+ data.tar.gz: b0b1dcbf53255bba00ecb4520231ae81303920a7
5
5
  SHA512:
6
- metadata.gz: cc36b636056eb80d9bb66d36a91e8f9f60e1e023f19e2f4d84d4388a5086ff803f40d7273286fa36fec80b54de1a998162780a3e6feee68affd79bea90383b93
7
- data.tar.gz: 043ab9c157d553489a1a62d6713864e68bddf9e11694b07fcea277dbbfac21a52323eeba065ffde61f0b148882621062539591567ed61c3c110eb5aa64b341b9
6
+ metadata.gz: 15379ea693fa354a8558b6723ff14586ec1990c5e028528918fbad082c90b16e30954b4d4941e72b3f28dfa64a4af9804e42d93b4cd40dfbad4c282c447fa8d7
7
+ data.tar.gz: 4923d3d2571ac652981e6cccdea912849222bd47c2dbf2afef25bf08a9452e7ca1ea57ef5b04a8bd1c319c285fea725176714a7fd907aada1a80eda45d0c40e2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.2.0
2
+
3
+ * `identifier` proc now gets called in `Grape::Attack::Request` context so that you have access to helper methods
4
+ such as `params` and Grape endpoint object.
5
+
1
6
  # 0.1.1
2
7
 
3
8
  * Support X-Real-IP for when behind loadbalancer [https://github.com/gottfrois/grape-attack/pull/3](https://github.com/gottfrois/grape-attack/pull/3)
@@ -21,8 +21,20 @@ module Grape
21
21
  request.route_path
22
22
  end
23
23
 
24
+ def params
25
+ request.route_params
26
+ end
27
+
28
+ def method_missing(method_name, *args, &block)
29
+ context.public_send(method_name, *args, &block)
30
+ end
31
+
32
+ def respond_to_missing?(method_name, include_private = false)
33
+ context.respond_to?(method_name)
34
+ end
35
+
24
36
  def client_identifier
25
- context.instance_eval(&throttle_options.identifier) || env['HTTP_X_REAL_IP'] || env['REMOTE_ADDR']
37
+ self.instance_eval(&throttle_options.identifier) || env['HTTP_X_REAL_IP'] || env['REMOTE_ADDR']
26
38
  end
27
39
 
28
40
  def throttle?
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Attack
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
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.1
4
+ version: 0.2.0
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-30 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape