grape-throttling 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +18 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +0 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/gemfiles/grape-0-16 +4 -0
- data/gemfiles/grape-1-0 +4 -0
- data/gemfiles/grape-1-5 +4 -0
- data/grape-throttling.gemspec +43 -0
- data/lib/grape/throttling.rb +18 -0
- data/lib/grape/throttling/configurable.rb +15 -0
- data/lib/grape/throttling/configuration.rb +19 -0
- data/lib/grape/throttling/counter.rb +32 -0
- data/lib/grape/throttling/error.rb +8 -0
- data/lib/grape/throttling/extension/api.rb +54 -0
- data/lib/grape/throttling/extension/request.rb +21 -0
- data/lib/grape/throttling/version.rb +7 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: af60e3bd619a2608ab8ab0ad68b3040b03bb14c26a84467e996e23ffb96db0bf
|
4
|
+
data.tar.gz: 1eadd65155a233b585f7c547f500760703dcc1d773cf45cc33b6eed76264bf83
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 32e1eb6a1d13978bbcd11e1f2fcad756ad91ad333e3c86d9617ff00c13006eb911e319a8097d04495c6c18fdccb7c9958fa4cccc1f3be3d7f150981fcc5ff48c
|
7
|
+
data.tar.gz: '09ef4bd9a04b3a6a1f054aff1dfb77e054a6c84995e0ba8ee76d92138bc1082278b44840e8c8412e48c4026de4257008145e1bdfd0f4d778f1e087f4f5c6797d'
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require:
|
2
|
+
# - rubocop-packaging
|
3
|
+
- rubocop-performance
|
4
|
+
|
5
|
+
Metrics/BlockLength:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Metrics/AbcSize:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Lint/NestedMethodDefinition:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Layout/RescueEnsureAlignment:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Gemspec/OrderedDependencies:
|
18
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
services:
|
3
|
+
- redis
|
4
|
+
language: ruby
|
5
|
+
rvm:
|
6
|
+
- 2.5.8
|
7
|
+
- 2.6.6
|
8
|
+
- 2.7.2
|
9
|
+
before_install: gem install bundler
|
10
|
+
after_success: bundle install
|
11
|
+
gemfile:
|
12
|
+
- gemfiles/grape-0-16
|
13
|
+
- gemfiles/grape-1-0
|
14
|
+
- gemfiles/grape-1-5
|
15
|
+
script: bundle exec rake test && bundle exec rubocop
|
data/CHANGELOG.md
ADDED
File without changes
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at 2729877005qq@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 OuYangJinTing
|
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,62 @@
|
|
1
|
+
# Grape::Throttling
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/OuYangJinTing/grape-throttling.svg)](https://travis-ci.org/OuYangJinTing/grape-throttling)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/grape-throttling.svg)](https://badge.fury.io/rb/grape-throttling)
|
5
|
+
|
6
|
+
If your api through [`grape`](https://github.com/ruby-grape/grape) build, you can use `grape-throttling` limit api rate.
|
7
|
+
|
8
|
+
- **Simple**. The you only need to call `use_throttle` in your api internal.
|
9
|
+
- **Throttle remind**. The response header include `X-RateLimit-Limit`, `X-Ratelimit-Used`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'grape-throttling'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
bundle install
|
23
|
+
```
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
gem install grape-throttling
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
class Api < Grape::API
|
35
|
+
use_throttle(max: 60, expire: 1.day, condition: proc { !current_user.is_admin? }, identity: proc { request.ip })
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
| Argument Key | Default | Description |
|
40
|
+
| ------------ | --------------------- | ------------------------------ |
|
41
|
+
| `max` | `60` | Maximum rate that can be used. |
|
42
|
+
| `expire` | `1.day` | Waiting time for reset rate. |
|
43
|
+
| `condition` | `proc { true }` | Condition of enabled throttle. |
|
44
|
+
| `identity` | `proc { request.ip }` | Used for throttle identity. |
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
49
|
+
|
50
|
+
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).
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/OuYangJinTing/grape-throttling>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/OuYangJinTing/grape-throttling/blob/master/CODE_OF_CONDUCT.md).
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
59
|
+
|
60
|
+
## Code of Conduct
|
61
|
+
|
62
|
+
Everyone interacting in the Grape::Throttling project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/OuYangJinTing/grape-throttling/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'grape/throttling'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/gemfiles/grape-0-16
ADDED
data/gemfiles/grape-1-0
ADDED
data/gemfiles/grape-1-5
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/grape/throttling/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'grape-throttling'
|
7
|
+
spec.version = Grape::Throttling::VERSION
|
8
|
+
spec.authors = ['OuYangJinTing']
|
9
|
+
spec.email = ['2729877005qq@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Grape rate limit exceeded.'
|
12
|
+
spec.description = 'Grape rate limit exceeded.'
|
13
|
+
spec.homepage = 'https://github.com/OuYangJinTing/grape-throttling'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
16
|
+
|
17
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/OuYangJinTing/grape-throttling.git'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/OuYangJinTing/grape-throttling/CHANGELOG.md'
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_runtime_dependency 'grape', '>= 0.16.1'
|
33
|
+
spec.add_runtime_dependency 'redis-namespace', '>= 0.8.0'
|
34
|
+
spec.add_runtime_dependency 'hiredis'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'rake'
|
37
|
+
spec.add_development_dependency 'rack-test'
|
38
|
+
spec.add_development_dependency 'pry'
|
39
|
+
spec.add_development_dependency 'minitest-reporters'
|
40
|
+
spec.add_development_dependency 'rubocop'
|
41
|
+
# spec.add_development_dependency 'rubocop-packaging'
|
42
|
+
spec.add_development_dependency 'rubocop-performance'
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'grape'
|
4
|
+
require 'redis-namespace'
|
5
|
+
|
6
|
+
require 'grape/throttling/counter'
|
7
|
+
require 'grape/throttling/extension/api'
|
8
|
+
require 'grape/throttling/extension/request'
|
9
|
+
require 'grape/throttling/configurable'
|
10
|
+
require 'grape/throttling/configuration'
|
11
|
+
require 'grape/throttling/error'
|
12
|
+
require 'grape/throttling/version'
|
13
|
+
|
14
|
+
module Grape
|
15
|
+
module Throttling # :nodoc:
|
16
|
+
extend Configurable
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grape
|
4
|
+
module Throttling
|
5
|
+
class Configuration # :nodoc:
|
6
|
+
attr_reader :redis
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@redis = ::Redis.new(url: 'redis://localhost:6379/0', driver: :hiredis)
|
10
|
+
end
|
11
|
+
|
12
|
+
def redis=(redis)
|
13
|
+
raise ArgumentError, 'must be provide redis instance' unless redis.is_a?(::Redis)
|
14
|
+
|
15
|
+
@redis = redis
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grape
|
4
|
+
module Throttling
|
5
|
+
class Counter # :nodoc:
|
6
|
+
delegate :set, :del, :expire, :ttl, to: :@redis
|
7
|
+
|
8
|
+
def initialize(expire)
|
9
|
+
@expire = expire.try(:to_i).to_i
|
10
|
+
env = ENV['RACK_ENV'].presence || 'unknow'
|
11
|
+
@redis = Redis::Namespace.new(
|
12
|
+
"grape-throttling:#{env}:counter",
|
13
|
+
redis: Throttling.config.redis
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(key)
|
18
|
+
@redis.get(key).to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
def incr(key)
|
22
|
+
response = begin
|
23
|
+
@redis.incr(key)
|
24
|
+
rescue Redis::CommandError => e
|
25
|
+
del(key) == 1 ? @redis.incr(key) : (raise e)
|
26
|
+
end
|
27
|
+
|
28
|
+
response.tap { expire(key, @expire) if response == 1 && @expire.positive? }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grape
|
4
|
+
module Throttling
|
5
|
+
module Extension
|
6
|
+
module Api # :nodoc:
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
module ClassMethods # :nodoc:
|
10
|
+
# rubocop:disable Style/ClassVars
|
11
|
+
def use_throttle(max: 60, expire: 1.day, condition: proc { true }, identity: proc { request.ip }) # rubocop:disable Metrics/MethodLength
|
12
|
+
max = max.try(:to_i).to_i
|
13
|
+
raise ArgumentError, 'max must be positive number' unless max.positive?
|
14
|
+
raise ArgumentError, 'condition must be Proc' unless condition.is_a?(Proc)
|
15
|
+
raise ArgumentError, 'identity must be Proc' unless identity.is_a?(Proc)
|
16
|
+
|
17
|
+
@@throttle = Counter.new(expire)
|
18
|
+
@@throttle.define_singleton_method(:max) { max }
|
19
|
+
@@throttle.define_singleton_method(:condition) { condition }
|
20
|
+
@@throttle.define_singleton_method(:identity) { identity }
|
21
|
+
|
22
|
+
helpers do
|
23
|
+
def mixin_throttle_headers(count)
|
24
|
+
header('X-RateLimit-Limit', @@throttle.max.to_s)
|
25
|
+
header('X-Ratelimit-Used', count.to_s)
|
26
|
+
header('X-RateLimit-Remaining', (@@throttle.max - count).to_s)
|
27
|
+
header('X-RateLimit-Reset', (Time.now.utc + @@throttle.ttl(request.id_throttle)).to_s)
|
28
|
+
|
29
|
+
header
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
before do
|
34
|
+
if instance_eval(&@@throttle.condition)
|
35
|
+
request.enabled_throttle = true
|
36
|
+
request.id_throttle = instance_eval(&@@throttle.identity)
|
37
|
+
count = @@throttle.get(request.id_throttle)
|
38
|
+
|
39
|
+
error!('API rate limit exceeded.', 403, mixin_throttle_headers(count)) if count >= @@throttle.max
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
after { mixin_throttle_headers(@@throttle.incr(request.id_throttle)) if request.throttle? }
|
44
|
+
|
45
|
+
@@throttle
|
46
|
+
end
|
47
|
+
# rubocop:enable Style/ClassVars
|
48
|
+
end
|
49
|
+
|
50
|
+
Grape::API.include(self)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grape
|
4
|
+
module Throttling
|
5
|
+
module Extension
|
6
|
+
module Request # :nodoc:
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
attr_accessor :enabled_throttle, :id_throttle
|
11
|
+
|
12
|
+
def throttle?
|
13
|
+
!!enabled_throttle
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Grape::Request.include self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grape-throttling
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OuYangJinTing
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: grape
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.16.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.16.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: redis-namespace
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hiredis
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
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: minitest-reporters
|
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
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-performance
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Grape rate limit exceeded.
|
140
|
+
email:
|
141
|
+
- 2729877005qq@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rubocop.yml"
|
148
|
+
- ".travis.yml"
|
149
|
+
- CHANGELOG.md
|
150
|
+
- CODE_OF_CONDUCT.md
|
151
|
+
- Gemfile
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- bin/console
|
156
|
+
- bin/setup
|
157
|
+
- gemfiles/grape-0-16
|
158
|
+
- gemfiles/grape-1-0
|
159
|
+
- gemfiles/grape-1-5
|
160
|
+
- grape-throttling.gemspec
|
161
|
+
- lib/grape/throttling.rb
|
162
|
+
- lib/grape/throttling/configurable.rb
|
163
|
+
- lib/grape/throttling/configuration.rb
|
164
|
+
- lib/grape/throttling/counter.rb
|
165
|
+
- lib/grape/throttling/error.rb
|
166
|
+
- lib/grape/throttling/extension/api.rb
|
167
|
+
- lib/grape/throttling/extension/request.rb
|
168
|
+
- lib/grape/throttling/version.rb
|
169
|
+
homepage: https://github.com/OuYangJinTing/grape-throttling
|
170
|
+
licenses:
|
171
|
+
- MIT
|
172
|
+
metadata:
|
173
|
+
homepage_uri: https://github.com/OuYangJinTing/grape-throttling
|
174
|
+
source_code_uri: https://github.com/OuYangJinTing/grape-throttling.git
|
175
|
+
changelog_uri: https://github.com/OuYangJinTing/grape-throttling/CHANGELOG.md
|
176
|
+
post_install_message:
|
177
|
+
rdoc_options: []
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: 2.4.0
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
requirements: []
|
191
|
+
rubygems_version: 3.1.4
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: Grape rate limit exceeded.
|
195
|
+
test_files: []
|