ruby-limiter 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/README.md +4 -4
- data/lib/limiter/version.rb +1 -1
- data/lib/ruby-limiter.rb +1 -0
- data/limiter.gemspec +7 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b5539b1f191ad06d89a530968e52be20b50668a3a3697cbd1c860875158cd888
|
4
|
+
data.tar.gz: 778c400b703c08064b34651f879e26d6cb68fc1b3525d3459a7a3ccd1559d0e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927ac894b0f0b5c55fcf7c877a8514d35ecb6db7be85a9b3ff286107666718652ec83c9fd4d767a8d3a60fd845a7831d11c37c46b4878ae43527e4c7ef82eb01
|
7
|
+
data.tar.gz: 7bbc065f4b96be1a69158e5dc7d586bf6b4b25cd6042e3c50e593124faf5d173f8d0b5f5cffacc80830666ae712d15ed531ab680f9c75b42a5713c4fff2b2990
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This gem implements a simple mechanism to throttle or rate-limit operations in R
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'limiter'
|
10
|
+
gem 'ruby-limiter'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -16,13 +16,13 @@ And then execute:
|
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
19
|
-
$ gem install limiter
|
19
|
+
$ gem install ruby-limiter
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
### Basic Usage
|
24
24
|
|
25
|
-
To rate limit calling an instance method, a mixin is provided. Simply specify the method to
|
25
|
+
To rate limit calling an instance method, a mixin is provided. Simply specify the method to be limited, and the maximum
|
26
26
|
rate that the method can be called. This rate is (by default) a number of requests per minute.
|
27
27
|
|
28
28
|
``` ruby
|
@@ -61,7 +61,7 @@ the `interval` parameter is optional (and defaults to 1 minute).
|
|
61
61
|
class Widget
|
62
62
|
def initialize
|
63
63
|
# create a rate-limited queue which allows 10000 operations per hour
|
64
|
-
@queue = RateQueue.new(10000, interval: 3600)
|
64
|
+
@queue = Limiter::RateQueue.new(10000, interval: 3600)
|
65
65
|
end
|
66
66
|
|
67
67
|
def tick
|
data/lib/limiter/version.rb
CHANGED
data/lib/ruby-limiter.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'limiter'
|
data/limiter.gemspec
CHANGED
@@ -14,6 +14,12 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'https://github.com/Shopify/limiter'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
21
|
+
end
|
22
|
+
|
17
23
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
24
|
f.match(%r{^(test|spec|features)/})
|
19
25
|
end
|
@@ -21,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
21
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
28
|
spec.require_paths = %w(lib)
|
23
29
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
30
|
+
spec.add_development_dependency 'bundler'
|
25
31
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
26
32
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
33
|
spec.add_development_dependency 'rubocop', '~> 0.56'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-limiter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- S. Brent Faulkner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,11 +103,13 @@ files:
|
|
103
103
|
- lib/limiter/mixin.rb
|
104
104
|
- lib/limiter/rate_queue.rb
|
105
105
|
- lib/limiter/version.rb
|
106
|
+
- lib/ruby-limiter.rb
|
106
107
|
- limiter.gemspec
|
107
108
|
homepage: https://github.com/Shopify/limiter
|
108
109
|
licenses:
|
109
110
|
- MIT
|
110
|
-
metadata:
|
111
|
+
metadata:
|
112
|
+
allowed_push_host: https://rubygems.org
|
111
113
|
post_install_message:
|
112
114
|
rdoc_options: []
|
113
115
|
require_paths:
|
@@ -123,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
- !ruby/object:Gem::Version
|
124
126
|
version: '0'
|
125
127
|
requirements: []
|
126
|
-
|
127
|
-
rubygems_version: 2.6.14
|
128
|
+
rubygems_version: 3.0.3
|
128
129
|
signing_key:
|
129
130
|
specification_version: 4
|
130
131
|
summary: Simple Ruby rate limiting mechanism.
|