with_rate_limit 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +6 -0
- data/lib/with_rate_limit/version.rb +1 -1
- data/with_rate_limit.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c541ac17b6b67e2725db7961db8c48a269cc8dcd28ad1ecde8b99c41402b0d88
|
4
|
+
data.tar.gz: a262916dc16088ac4301aa1c543d410ed672d465159b960afd5007c9203f7542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 930d0b7213492a1ab8d9abdafeefce5cecf6054209129f870aa56b5ad26ba1d572285e6f04add6284e9a5f7a572aba77810691b5e5c8b24f23e4f3643d6c3ded
|
7
|
+
data.tar.gz: b8cf19113b5bb6641246194a25e409d2b8c607e6e119d6e802573c951a28fdd7c3f93568aa76faa3d1cc18671cb8cc2447880830b8371601a274e70b8f282ba8
|
data/README.md
CHANGED
@@ -22,6 +22,8 @@ Or install it yourself as:
|
|
22
22
|
## Basic Usage
|
23
23
|
|
24
24
|
```ruby
|
25
|
+
include WithRateLimit
|
26
|
+
|
25
27
|
interval = 1 # interval in seconds
|
26
28
|
rate_limit = 5 # number of operations within given interval
|
27
29
|
options = {
|
@@ -40,6 +42,8 @@ end
|
|
40
42
|
If you need to set up multiple rate limits, i.e. 5000 requests/day **and** 5 requests/sec, you can nest `with_rate_limit` calls.
|
41
43
|
|
42
44
|
```ruby
|
45
|
+
include WithRateLimit
|
46
|
+
|
43
47
|
with_rate_limit 1.day.to_i, 5000 do
|
44
48
|
with_rate_limit 1, 5 do
|
45
49
|
# do something here
|
@@ -56,6 +60,8 @@ large intervals with limit that are likely to exceeded early as it may block app
|
|
56
60
|
Raises an `WithRateLimit::LimitExceededError` with the number of second to wait until next interval.
|
57
61
|
|
58
62
|
```ruby
|
63
|
+
include WithRateLimit
|
64
|
+
|
59
65
|
with_rate_limit 1, 5 do
|
60
66
|
# do something
|
61
67
|
rescue WithRateLimit::LimitExceededError => e
|
data/with_rate_limit.gemspec
CHANGED
@@ -8,14 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
|
9
9
|
spec.summary = %q{Rate limits operations that are passed in to block}
|
10
10
|
spec.description = %q{Allows operations that are passed into `with_rate_limit` block to be rate limited}
|
11
|
-
spec.homepage = "https://github.com/aterletskiy/
|
11
|
+
spec.homepage = "https://github.com/aterletskiy/with-rate-limit"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
14
|
|
15
15
|
# spec.metadata["allowed_push_host"] = "http://mygemserver.com"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/aterletskiy/
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/aterletskiy/with-rate-limit"
|
19
19
|
spec.metadata["changelog_uri"] = "https://github.com/aterletskiy/with_rate_limit/CHANGELOG.md"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: with_rate_limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksandr Terletskiy
|
@@ -38,12 +38,12 @@ files:
|
|
38
38
|
- lib/with_rate_limit/strategy/sleep.rb
|
39
39
|
- lib/with_rate_limit/version.rb
|
40
40
|
- with_rate_limit.gemspec
|
41
|
-
homepage: https://github.com/aterletskiy/
|
41
|
+
homepage: https://github.com/aterletskiy/with-rate-limit
|
42
42
|
licenses:
|
43
43
|
- MIT
|
44
44
|
metadata:
|
45
|
-
homepage_uri: https://github.com/aterletskiy/
|
46
|
-
source_code_uri: https://github.com/aterletskiy/
|
45
|
+
homepage_uri: https://github.com/aterletskiy/with-rate-limit
|
46
|
+
source_code_uri: https://github.com/aterletskiy/with-rate-limit
|
47
47
|
changelog_uri: https://github.com/aterletskiy/with_rate_limit/CHANGELOG.md
|
48
48
|
post_install_message:
|
49
49
|
rdoc_options: []
|