istox 0.1.114 → 0.1.115
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/Gemfile.lock +1 -1
- data/lib/istox/helpers/rate_limit.rb +8 -2
- data/lib/istox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf656e8345ac7129697ea2a2366a417de683989f09b627fb4d71b062678fce32
|
|
4
|
+
data.tar.gz: 959ca575d5ffa3044965cbd1224e7174cd961db3d5f6f5eb5892441cc9db124f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 471dd7ceef7f24b765837cd0a9144c22b00cd22a422df83002890ab4706d22b502b681f161fbe1350faca263a7f95e2965438f2381142d183bc46b5cbe7e7c66
|
|
7
|
+
data.tar.gz: 695beb8e1b6b9d2de1a5c57ef6022e6d52d41bd1f890a12598fe9ef3a28df24cbbae6ce56d9dc9799c2dd4fa122d344a3d13966c36a0b0db96eac6d25b8d8e44
|
data/Gemfile.lock
CHANGED
|
@@ -92,8 +92,9 @@ module Istox
|
|
|
92
92
|
# @option options [Integer] :interval How far back to retrieve activity.
|
|
93
93
|
# @option options [Integer] :threshold Maximum number of actions
|
|
94
94
|
def limit!(subject, options = {})
|
|
95
|
-
add(subject)
|
|
96
95
|
raise ::Istox::RateLimitExceedError if exceeded?(subject, options)
|
|
96
|
+
|
|
97
|
+
add(subject)
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
# Check if next execution will cause the rate limit to be exceeded, return false if exceeded, else return true
|
|
@@ -103,8 +104,13 @@ module Istox
|
|
|
103
104
|
# @option options [Integer] :interval How far back to retrieve activity.
|
|
104
105
|
# @option options [Integer] :threshold Maximum number of actions
|
|
105
106
|
def limit?(subject, options = {})
|
|
107
|
+
result = within_bounds?(subject, options)
|
|
108
|
+
|
|
109
|
+
return result unless result
|
|
110
|
+
|
|
106
111
|
add(subject)
|
|
107
|
-
|
|
112
|
+
|
|
113
|
+
true
|
|
108
114
|
end
|
|
109
115
|
|
|
110
116
|
# Execute a block once the rate limit is within bounds
|
data/lib/istox/version.rb
CHANGED