grape-throttler 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +81 -70
- data/README.md +1 -1
- data/lib/grape-throttler/middleware/throttle_middleware.rb +2 -2
- data/lib/grape-throttler/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9934c03ccbf10c6882dc894cd6e523782e3816f46d1d913fe55708c6e8319958
|
4
|
+
data.tar.gz: 0dcf12981720976ea2610a7663f4449f6b2122a1e6e83e3a67a860fcfe85b2a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5311346bf3903a17e77a4ad257a47a9cc779218b7cc05569e3b987b8a8f4f05090a04e16ea37d2f4a980a81ebcf14994bb2867b99a6b5afd936e21dde702952
|
7
|
+
data.tar.gz: 1e840e0d3d9ec6f7bec1ea3337b8f8c0c9ad7c6fccb012c7c3549c043ccf67784b27494765c509f7507e7408b7d232e9e349e14e80a1db709d74edda2f12edd9
|
data/.rubocop.yml
CHANGED
@@ -2,9 +2,14 @@ require:
|
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rspec
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
NewCops: enable
|
6
7
|
DisplayCopNames: true
|
7
8
|
DisplayStyleGuide: true
|
9
|
+
Gemspec/RequiredRubyVersion:
|
10
|
+
Enabled: false
|
11
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
12
|
+
Enabled: true
|
8
13
|
Layout/EmptyLinesAroundBlockBody:
|
9
14
|
Exclude:
|
10
15
|
- 'spec/**/**/*'
|
@@ -12,12 +17,18 @@ Layout/EmptyLinesAroundClassBody:
|
|
12
17
|
EnforcedStyle: empty_lines_except_namespace
|
13
18
|
Layout/EmptyLinesAroundModuleBody:
|
14
19
|
EnforcedStyle: empty_lines_except_namespace
|
20
|
+
Layout/LineLength:
|
21
|
+
Max: 100
|
22
|
+
Layout/SpaceAroundMethodCallOperator:
|
23
|
+
Enabled: true
|
24
|
+
Lint/RaiseException:
|
25
|
+
Enabled: true
|
26
|
+
Lint/StructNewOverride:
|
27
|
+
Enabled: true
|
15
28
|
Metrics/BlockLength:
|
16
29
|
Exclude:
|
17
30
|
- 'spec/**/**/*'
|
18
31
|
- '*.gemspec'
|
19
|
-
Metrics/LineLength:
|
20
|
-
Max: 100
|
21
32
|
Naming/FileName:
|
22
33
|
Enabled: false
|
23
34
|
RSpec/ExampleLength:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,9 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.1.1] - 2021-07-05
|
10
|
+
### Changed
|
11
|
+
- Linter fixes
|
12
|
+
|
9
13
|
## [1.1.0] - 2019-11-25
|
10
14
|
### Added
|
11
15
|
- Added CHANGELOG.md
|
16
|
+
- Added ruby 2.7 support
|
12
17
|
### Changed
|
13
18
|
- Refactor code to clean up lint errors
|
14
19
|
|
data/Gemfile.lock
CHANGED
@@ -1,101 +1,112 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape-throttler (1.1.
|
4
|
+
grape-throttler (1.1.1)
|
5
5
|
grape (>= 0.16.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (6.
|
10
|
+
activesupport (6.1.3.2)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
i18n (>=
|
13
|
-
minitest (
|
14
|
-
tzinfo (~>
|
15
|
-
zeitwerk (~> 2.
|
16
|
-
ast (2.4.
|
17
|
-
|
18
|
-
descendants_tracker (~> 0.0.4)
|
19
|
-
ice_nine (~> 0.11.0)
|
20
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
21
|
-
builder (3.2.3)
|
22
|
-
coercible (1.0.0)
|
23
|
-
descendants_tracker (~> 0.0.1)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
zeitwerk (~> 2.3)
|
16
|
+
ast (2.4.2)
|
17
|
+
builder (3.2.4)
|
24
18
|
colorize (0.8.1)
|
25
|
-
concurrent-ruby (1.1.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
concurrent-ruby (1.1.8)
|
20
|
+
diff-lcs (1.4.4)
|
21
|
+
dry-configurable (0.12.1)
|
22
|
+
concurrent-ruby (~> 1.0)
|
23
|
+
dry-core (~> 0.5, >= 0.5.0)
|
24
|
+
dry-container (0.7.2)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
27
|
+
dry-core (0.5.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
dry-inflector (0.2.0)
|
30
|
+
dry-logic (1.2.0)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
dry-core (~> 0.5, >= 0.5)
|
33
|
+
dry-types (1.5.1)
|
34
|
+
concurrent-ruby (~> 1.0)
|
35
|
+
dry-container (~> 0.3)
|
36
|
+
dry-core (~> 0.5, >= 0.5)
|
37
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
38
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
39
|
+
fakeredis (0.8.0)
|
40
|
+
redis (~> 4.1)
|
41
|
+
fasterer (0.9.0)
|
33
42
|
colorize (~> 0.7)
|
34
43
|
ruby_parser (>= 3.14.1)
|
35
|
-
grape (1.
|
44
|
+
grape (1.5.3)
|
36
45
|
activesupport
|
37
46
|
builder
|
47
|
+
dry-types (>= 1.1)
|
38
48
|
mustermann-grape (~> 1.0.0)
|
39
49
|
rack (>= 1.3.0)
|
40
50
|
rack-accept
|
41
|
-
|
42
|
-
i18n (1.7.0)
|
51
|
+
i18n (1.8.10)
|
43
52
|
concurrent-ruby (~> 1.0)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
mustermann (1.0.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
rack (2.0.7)
|
53
|
+
minitest (5.14.4)
|
54
|
+
mustermann (1.1.1)
|
55
|
+
ruby2_keywords (~> 0.0.1)
|
56
|
+
mustermann-grape (1.0.1)
|
57
|
+
mustermann (>= 1.0.0)
|
58
|
+
parallel (1.20.1)
|
59
|
+
parser (3.0.1.1)
|
60
|
+
ast (~> 2.4.1)
|
61
|
+
rack (2.2.3)
|
54
62
|
rack-accept (0.4.5)
|
55
63
|
rack (>= 0.4)
|
56
64
|
rack-test (1.1.0)
|
57
65
|
rack (>= 1.0, < 3)
|
58
66
|
rainbow (3.0.0)
|
59
|
-
rake (13.0.
|
60
|
-
redis (4.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
rspec-
|
65
|
-
|
66
|
-
rspec-
|
67
|
-
rspec-
|
67
|
+
rake (13.0.3)
|
68
|
+
redis (4.2.5)
|
69
|
+
regexp_parser (2.1.1)
|
70
|
+
rexml (3.2.5)
|
71
|
+
rspec (3.10.0)
|
72
|
+
rspec-core (~> 3.10.0)
|
73
|
+
rspec-expectations (~> 3.10.0)
|
74
|
+
rspec-mocks (~> 3.10.0)
|
75
|
+
rspec-core (3.10.1)
|
76
|
+
rspec-support (~> 3.10.0)
|
77
|
+
rspec-expectations (3.10.1)
|
68
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
-
rspec-support (~> 3.
|
70
|
-
rspec-mocks (3.
|
79
|
+
rspec-support (~> 3.10.0)
|
80
|
+
rspec-mocks (3.10.2)
|
71
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
-
rspec-support (~> 3.
|
73
|
-
rspec-support (3.
|
74
|
-
rubocop (
|
75
|
-
jaro_winkler (~> 1.5.1)
|
82
|
+
rspec-support (~> 3.10.0)
|
83
|
+
rspec-support (3.10.2)
|
84
|
+
rubocop (1.14.0)
|
76
85
|
parallel (~> 1.10)
|
77
|
-
parser (>=
|
86
|
+
parser (>= 3.0.0.0)
|
78
87
|
rainbow (>= 2.2.2, < 4.0)
|
88
|
+
regexp_parser (>= 1.8, < 3.0)
|
89
|
+
rexml
|
90
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
79
91
|
ruby-progressbar (~> 1.7)
|
80
|
-
unicode-display_width (>= 1.4.0, <
|
81
|
-
rubocop-
|
82
|
-
|
83
|
-
rubocop-
|
84
|
-
rubocop (>= 0.
|
85
|
-
|
86
|
-
|
92
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
93
|
+
rubocop-ast (1.5.0)
|
94
|
+
parser (>= 3.0.1.1)
|
95
|
+
rubocop-performance (1.11.3)
|
96
|
+
rubocop (>= 1.7.0, < 2.0)
|
97
|
+
rubocop-ast (>= 0.4.0)
|
98
|
+
rubocop-rspec (2.3.0)
|
99
|
+
rubocop (~> 1.0)
|
100
|
+
rubocop-ast (>= 1.1.0)
|
101
|
+
ruby-progressbar (1.11.0)
|
102
|
+
ruby2_keywords (0.0.4)
|
103
|
+
ruby_parser (3.15.1)
|
87
104
|
sexp_processor (~> 4.9)
|
88
|
-
sexp_processor (4.
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
virtus (1.0.5)
|
94
|
-
axiom-types (~> 0.1)
|
95
|
-
coercible (~> 1.0)
|
96
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
97
|
-
equalizer (~> 0.0, >= 0.0.9)
|
98
|
-
zeitwerk (2.2.1)
|
105
|
+
sexp_processor (4.15.2)
|
106
|
+
tzinfo (2.0.4)
|
107
|
+
concurrent-ruby (~> 1.0)
|
108
|
+
unicode-display_width (2.0.0)
|
109
|
+
zeitwerk (2.4.2)
|
99
110
|
|
100
111
|
PLATFORMS
|
101
112
|
ruby
|
@@ -113,4 +124,4 @@ DEPENDENCIES
|
|
113
124
|
rubocop-rspec
|
114
125
|
|
115
126
|
BUNDLED WITH
|
116
|
-
|
127
|
+
2.2.17
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ The `user_key` parameter is a function that can be used to determine a custom id
|
|
53
53
|
|
54
54
|
**Logging**
|
55
55
|
|
56
|
-
The gem will log errors to
|
56
|
+
The gem will log errors to $stdout by default. If you prefer a different logger you can use the `logger` option to pass in your own logger.
|
57
57
|
|
58
58
|
```ruby
|
59
59
|
use GrapeThrottler::Middleware::ThrottleMiddleware, cache: Redis.new, logger: Logger.new('my_custom_log.log')
|
@@ -4,13 +4,13 @@ module GrapeThrottler
|
|
4
4
|
module Middleware
|
5
5
|
class ThrottleMiddleware < Grape::Middleware::Base
|
6
6
|
|
7
|
-
COUNTER_START
|
7
|
+
COUNTER_START = 0
|
8
8
|
|
9
9
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
10
10
|
# rubocop:disable Metrics/PerceivedComplexity, Lint/AssignmentInCondition
|
11
11
|
def before
|
12
12
|
endpoint = env['api.endpoint']
|
13
|
-
logger = options[:logger] || Logger.new(
|
13
|
+
logger = options[:logger] || Logger.new($stdout)
|
14
14
|
|
15
15
|
return unless throttle_options = endpoint.route_setting(:throttle)
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-throttler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description:
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- j.gomez@drexed.com
|
156
156
|
executables: []
|
@@ -180,7 +180,7 @@ homepage: http://drexed.github.io/grape-throttler
|
|
180
180
|
licenses:
|
181
181
|
- MIT
|
182
182
|
metadata: {}
|
183
|
-
post_install_message:
|
183
|
+
post_install_message:
|
184
184
|
rdoc_options: []
|
185
185
|
require_paths:
|
186
186
|
- lib
|
@@ -195,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
rubygems_version: 3.
|
199
|
-
signing_key:
|
198
|
+
rubygems_version: 3.2.17
|
199
|
+
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: Middleware for Grape to add endpoint-specific throttling.
|
202
202
|
test_files: []
|