rails_rate_limiter 0.1.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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +155 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rails_rate_limiter.rb +71 -0
- data/lib/rails_rate_limiter/error.rb +4 -0
- data/lib/rails_rate_limiter/result.rb +13 -0
- data/lib/rails_rate_limiter/strategies.rb +1 -0
- data/lib/rails_rate_limiter/strategies/sliding_window_log.rb +65 -0
- data/lib/rails_rate_limiter/version.rb +3 -0
- data/rails_rate_limiter.gemspec +30 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d82c4e44c5fbd709bf78fdd289e80d7d09ad22e9
|
4
|
+
data.tar.gz: 54e6b7c805bb217398b06dec94f4002522ac8b48
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e42895cbe22f74b33b13f8732202b746415e3f8d38117007890ee05333378ea38c5e0acc242e090aa82e013ace738636df004b0d3bdda976fc0b8a3a16b40e97
|
7
|
+
data.tar.gz: a078a449b36a996444d3588d5384e6a6cf60292d7cd0da726d015633df168980ba8ebd51351015cf5b90d41c9b2f09d9faa82a5ed2fd0d6112b70cc7b51bdf3c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails_rate_limiter (0.1.0)
|
5
|
+
rails (>= 4.2)
|
6
|
+
redis (~> 3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.2.0)
|
12
|
+
actionpack (= 5.2.0)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.0)
|
16
|
+
actionpack (= 5.2.0)
|
17
|
+
actionview (= 5.2.0)
|
18
|
+
activejob (= 5.2.0)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.2.0)
|
22
|
+
actionview (= 5.2.0)
|
23
|
+
activesupport (= 5.2.0)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.2.0)
|
29
|
+
activesupport (= 5.2.0)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.2.0)
|
35
|
+
activesupport (= 5.2.0)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.2.0)
|
38
|
+
activesupport (= 5.2.0)
|
39
|
+
activerecord (5.2.0)
|
40
|
+
activemodel (= 5.2.0)
|
41
|
+
activesupport (= 5.2.0)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.0)
|
44
|
+
actionpack (= 5.2.0)
|
45
|
+
activerecord (= 5.2.0)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.0)
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
|
+
i18n (>= 0.7, < 2)
|
50
|
+
minitest (~> 5.1)
|
51
|
+
tzinfo (~> 1.1)
|
52
|
+
arel (9.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
coderay (1.1.2)
|
55
|
+
concurrent-ruby (1.0.5)
|
56
|
+
crass (1.0.4)
|
57
|
+
diff-lcs (1.3)
|
58
|
+
erubi (1.7.1)
|
59
|
+
globalid (0.4.1)
|
60
|
+
activesupport (>= 4.2.0)
|
61
|
+
i18n (1.0.1)
|
62
|
+
concurrent-ruby (~> 1.0)
|
63
|
+
loofah (2.2.2)
|
64
|
+
crass (~> 1.0.2)
|
65
|
+
nokogiri (>= 1.5.9)
|
66
|
+
mail (2.7.0)
|
67
|
+
mini_mime (>= 0.1.1)
|
68
|
+
marcel (0.3.2)
|
69
|
+
mimemagic (~> 0.3.2)
|
70
|
+
method_source (0.9.0)
|
71
|
+
mimemagic (0.3.2)
|
72
|
+
mini_mime (1.0.0)
|
73
|
+
mini_portile2 (2.3.0)
|
74
|
+
minitest (5.11.3)
|
75
|
+
mock_redis (0.17.3)
|
76
|
+
nio4r (2.3.1)
|
77
|
+
nokogiri (1.8.2)
|
78
|
+
mini_portile2 (~> 2.3.0)
|
79
|
+
pry (0.11.3)
|
80
|
+
coderay (~> 1.1.0)
|
81
|
+
method_source (~> 0.9.0)
|
82
|
+
rack (2.0.5)
|
83
|
+
rack-test (1.0.0)
|
84
|
+
rack (>= 1.0, < 3)
|
85
|
+
rails (5.2.0)
|
86
|
+
actioncable (= 5.2.0)
|
87
|
+
actionmailer (= 5.2.0)
|
88
|
+
actionpack (= 5.2.0)
|
89
|
+
actionview (= 5.2.0)
|
90
|
+
activejob (= 5.2.0)
|
91
|
+
activemodel (= 5.2.0)
|
92
|
+
activerecord (= 5.2.0)
|
93
|
+
activestorage (= 5.2.0)
|
94
|
+
activesupport (= 5.2.0)
|
95
|
+
bundler (>= 1.3.0)
|
96
|
+
railties (= 5.2.0)
|
97
|
+
sprockets-rails (>= 2.0.0)
|
98
|
+
rails-dom-testing (2.0.3)
|
99
|
+
activesupport (>= 4.2.0)
|
100
|
+
nokogiri (>= 1.6)
|
101
|
+
rails-html-sanitizer (1.0.4)
|
102
|
+
loofah (~> 2.2, >= 2.2.2)
|
103
|
+
railties (5.2.0)
|
104
|
+
actionpack (= 5.2.0)
|
105
|
+
activesupport (= 5.2.0)
|
106
|
+
method_source
|
107
|
+
rake (>= 0.8.7)
|
108
|
+
thor (>= 0.18.1, < 2.0)
|
109
|
+
rake (10.5.0)
|
110
|
+
redis (3.3.5)
|
111
|
+
rspec-core (3.7.1)
|
112
|
+
rspec-support (~> 3.7.0)
|
113
|
+
rspec-expectations (3.7.0)
|
114
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
115
|
+
rspec-support (~> 3.7.0)
|
116
|
+
rspec-mocks (3.7.0)
|
117
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
+
rspec-support (~> 3.7.0)
|
119
|
+
rspec-rails (3.7.2)
|
120
|
+
actionpack (>= 3.0)
|
121
|
+
activesupport (>= 3.0)
|
122
|
+
railties (>= 3.0)
|
123
|
+
rspec-core (~> 3.7.0)
|
124
|
+
rspec-expectations (~> 3.7.0)
|
125
|
+
rspec-mocks (~> 3.7.0)
|
126
|
+
rspec-support (~> 3.7.0)
|
127
|
+
rspec-support (3.7.1)
|
128
|
+
sprockets (3.7.1)
|
129
|
+
concurrent-ruby (~> 1.0)
|
130
|
+
rack (> 1, < 3)
|
131
|
+
sprockets-rails (3.2.1)
|
132
|
+
actionpack (>= 4.0)
|
133
|
+
activesupport (>= 4.0)
|
134
|
+
sprockets (>= 3.0.0)
|
135
|
+
thor (0.20.0)
|
136
|
+
thread_safe (0.3.6)
|
137
|
+
tzinfo (1.2.5)
|
138
|
+
thread_safe (~> 0.1)
|
139
|
+
websocket-driver (0.7.0)
|
140
|
+
websocket-extensions (>= 0.1.0)
|
141
|
+
websocket-extensions (0.1.3)
|
142
|
+
|
143
|
+
PLATFORMS
|
144
|
+
ruby
|
145
|
+
|
146
|
+
DEPENDENCIES
|
147
|
+
bundler (~> 1.16)
|
148
|
+
mock_redis
|
149
|
+
pry
|
150
|
+
rails_rate_limiter!
|
151
|
+
rake (~> 10.0)
|
152
|
+
rspec-rails
|
153
|
+
|
154
|
+
BUNDLED WITH
|
155
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Ruslan Kotov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# RailsRateLimiter
|
2
|
+
|
3
|
+
This is a high level rate limiting gem for Ruby on Rails using Redis. It limits amount of requests on controllers level, that allows you to customize rate limiting options using everything that available in your action, e.g. `current_user`.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails_rate_limiter'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rails_rate_limiter
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Add `include RateLimiter` to the controller you want to rate limit. It allows you to use `rate_limit` class method.
|
24
|
+
|
25
|
+
### Example
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
class Posts < ApplicationController
|
29
|
+
rate_limit limit: 100, per: 1.hour, only: :index do |info|
|
30
|
+
render plain: I18n.t('rate_limit_exceeded', seconds: info.time_left),
|
31
|
+
status: :too_many_requests
|
32
|
+
end
|
33
|
+
|
34
|
+
def index
|
35
|
+
# ...
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### `rate_limit` arguments
|
41
|
+
* `&block` - executes if rate limit was exceeded. This argument is mandatory. `RateLimiter::Error` is raising if not passed.
|
42
|
+
|
43
|
+
### `rate_limit` options
|
44
|
+
* `strategy` - rate limiting strategy. Default value is :sliding_window_log
|
45
|
+
* `limit` - the number of allowed request per time period. Supports lambda and proc. Default value is 100
|
46
|
+
* `per` - time period in seconds. Supports lambda and proc as well. Default value is `1.hour`
|
47
|
+
* `pattern` - lambda or proc. Can be used if you want to use something instead of IP as cache key identifier. For example `-> current_user.id`. Uses `request.remote_ip` by default.
|
48
|
+
* `client` - Redis client. Uses `Redis.new` by default.
|
49
|
+
|
50
|
+
You can also use any options which are available for `before_action` callback because `rate_limiter` uses it under the hood.
|
51
|
+
|
52
|
+
## Strategies
|
53
|
+
|
54
|
+
At this moment gem supports only Sliding Window Log strategy to rate limit requests. You can read more about different strategies [here](https://blog.figma.com/an-alternative-approach-to-rate-limiting-f8a06cf7c94c).
|
55
|
+
|
56
|
+
### Sliding Window Log
|
57
|
+
|
58
|
+

|
59
|
+
|
60
|
+
## Development
|
61
|
+
|
62
|
+
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.
|
63
|
+
|
64
|
+
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).
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_rate_limiter.
|
69
|
+
|
70
|
+
## License
|
71
|
+
|
72
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rails_rate_limiter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require 'active_support/inflector'
|
3
|
+
|
4
|
+
require 'rails_rate_limiter/version'
|
5
|
+
require 'rails_rate_limiter/strategies'
|
6
|
+
require 'rails_rate_limiter/error'
|
7
|
+
|
8
|
+
module RailsRateLimiter
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
class_methods do
|
12
|
+
# Sets callback that checks if rate limit was exceeded.
|
13
|
+
#
|
14
|
+
# == Arguments:
|
15
|
+
#
|
16
|
+
# +&block+ - Executed if rate limit exceded.
|
17
|
+
# This argument is mandatory.
|
18
|
+
#
|
19
|
+
# == Options:
|
20
|
+
#
|
21
|
+
# +strategy+ - Rate limiting strategy.
|
22
|
+
# Default value is :sliding_window_log
|
23
|
+
#
|
24
|
+
# +limit+ - The number of allowed request per time period.
|
25
|
+
# Supports lambda and proc. Default value is 100
|
26
|
+
# +per+ - Time period in seconds. Supports lambda and proc as well.
|
27
|
+
# Default value is 1.hour
|
28
|
+
# +pattern+ - lambda or proc. Can be used if you want to use something
|
29
|
+
# instead of IP as cache key identifier. For example
|
30
|
+
# `->current_user.id`. Uses `request.remote_ip` by default.
|
31
|
+
# +client+ - Redis client. Uses `Redis.new` by default.
|
32
|
+
#
|
33
|
+
# Any option avaiable for `before_action` can be used.
|
34
|
+
#
|
35
|
+
# == Examples:
|
36
|
+
#
|
37
|
+
# rate_limit limit: 100, per: 1.hour, only: :index do |info|
|
38
|
+
# render plain: I18n.t('rate_limit_exceeded', seconds: info.time_left),
|
39
|
+
# status: :too_many_requests
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
def rate_limit(options = {}, &block)
|
43
|
+
raise Error, 'Handling block was not provided' unless block_given?
|
44
|
+
|
45
|
+
# Separate out options related only to rate limiting
|
46
|
+
strategy = (options.delete(:strategy) || 'sliding_window_log').to_s
|
47
|
+
limit = options.delete(:limit) || 100
|
48
|
+
per = options.delete(:per) || 3600
|
49
|
+
pattern = options.delete(:pattern)
|
50
|
+
client = options.delete(:client)
|
51
|
+
|
52
|
+
before_action(options) do
|
53
|
+
check_rate_limits(strategy, limit, per, pattern, client, block)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def check_rate_limits(strategy, limit, per, pattern, client, block)
|
61
|
+
requester = pattern || request.remote_ip
|
62
|
+
|
63
|
+
strategy_class =
|
64
|
+
"RailsRateLimiter::Strategies::#{strategy.classify}".constantize
|
65
|
+
result = strategy_class.new(limit, per, requester, client).run
|
66
|
+
return unless result.limit_exceeded?
|
67
|
+
# instance_exec is using here because simple block.call executes block in
|
68
|
+
# a wrong context that leads to not preventing action execution after render
|
69
|
+
instance_exec result, &block
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'strategies/sliding_window_log'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'active_support/time'
|
2
|
+
require_relative '../result'
|
3
|
+
|
4
|
+
module RailsRateLimiter
|
5
|
+
module Strategies
|
6
|
+
class SlidingWindowLog
|
7
|
+
TIMESTAMP_ACCURACY = 10_000
|
8
|
+
|
9
|
+
attr_reader :limit, :expires_in, :requester_pattern
|
10
|
+
|
11
|
+
def initialize(limit, per, requester, client = nil)
|
12
|
+
@limit = limit.respond_to?(:call) ? limit.call : limit
|
13
|
+
@expires_in = calculate_expires_in(per)
|
14
|
+
@requester_pattern = compute_requester_pattern(requester)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
remove_expired_set_members
|
20
|
+
return Result.new(time_left) if client.zcard(cache_key) >= limit
|
21
|
+
log_request
|
22
|
+
Result.new(0)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def client
|
28
|
+
@client ||= Redis.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def remove_expired_set_members
|
32
|
+
# remove all SORTED SET members that have a score < current_timestamp
|
33
|
+
client.zremrangebyscore(cache_key, '-inf', "(#{current_timestamp}")
|
34
|
+
end
|
35
|
+
|
36
|
+
def log_request
|
37
|
+
expiring_timestamp = current_timestamp + expires_in
|
38
|
+
client.zadd(cache_key, expiring_timestamp, current_timestamp)
|
39
|
+
end
|
40
|
+
|
41
|
+
def time_left
|
42
|
+
timestamp = client.zrange(cache_key, 0, 0, with_scores: true)[0][1]
|
43
|
+
((timestamp - current_timestamp).to_f / TIMESTAMP_ACCURACY).ceil
|
44
|
+
end
|
45
|
+
|
46
|
+
def cache_key
|
47
|
+
"rate_limiter_#{requester_pattern}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def current_timestamp
|
51
|
+
@current_timestamp ||= (Time.zone.now.to_f * TIMESTAMP_ACCURACY).to_i
|
52
|
+
end
|
53
|
+
|
54
|
+
def calculate_expires_in(per)
|
55
|
+
value = per.respond_to?(:call) ? per.call : per
|
56
|
+
(value.to_f * TIMESTAMP_ACCURACY).to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
def compute_requester_pattern(requester)
|
60
|
+
return "ip_#{requester}" unless requester.respond_to?(:call)
|
61
|
+
"custom_#{requester.call}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rails_rate_limiter/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rails_rate_limiter'
|
7
|
+
spec.version = RailsRateLimiter::VERSION
|
8
|
+
spec.authors = ['Ruslan Kotov']
|
9
|
+
spec.email = %w[rkotov93@gmail.com]
|
10
|
+
|
11
|
+
spec.summary = 'Requests rate limiting library for Ruby on Rails'
|
12
|
+
spec.homepage = 'https://github.com/rkotov93/rails_rate_limiter'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
+
f.match(%r{^(test|spec|features)/})
|
17
|
+
end
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'rails', '>= 4.2'
|
23
|
+
spec.add_runtime_dependency 'redis', '~> 3.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec-rails'
|
28
|
+
spec.add_development_dependency 'pry'
|
29
|
+
spec.add_development_dependency 'mock_redis'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_rate_limiter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ruslan Kotov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: redis
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mock_redis
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- rkotov93@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
122
|
+
- Gemfile.lock
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- bin/console
|
127
|
+
- bin/setup
|
128
|
+
- lib/rails_rate_limiter.rb
|
129
|
+
- lib/rails_rate_limiter/error.rb
|
130
|
+
- lib/rails_rate_limiter/result.rb
|
131
|
+
- lib/rails_rate_limiter/strategies.rb
|
132
|
+
- lib/rails_rate_limiter/strategies/sliding_window_log.rb
|
133
|
+
- lib/rails_rate_limiter/version.rb
|
134
|
+
- rails_rate_limiter.gemspec
|
135
|
+
homepage: https://github.com/rkotov93/rails_rate_limiter
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.6.13
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: Requests rate limiting library for Ruby on Rails
|
159
|
+
test_files: []
|