ratelimit 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e82db7b9218b7b7df79470dc1220e90df8f5bc2
4
- data.tar.gz: 73ab3802584dd987f5cb944335e37958ebdcad08
3
+ metadata.gz: f9759fc3e7da10acf75e0b15ba6f90a901257543
4
+ data.tar.gz: b3bcdc0daa3076dfe081942e90a922125a772019
5
5
  SHA512:
6
- metadata.gz: cef293468c29242233d60053461d244ef025d85eb3b593684ec8ec7de76c9eb40c12a625532225aa27e14e77c5c9a83410400c5c909b983c43eda4f44c9ec87f
7
- data.tar.gz: 71029040e9883fb9949b08d47cb69abcef9d9b93a02a42758c22bffffa67b3c41db617e6a8ef80baadbd500b5410b9deb2541c0bde4d697efa4b5082c06b5665
6
+ metadata.gz: e4a346d5455ff73cd2218f312ac08f098f2acc80041995a1b9e00ad93dfa37ba27d27be293c2a741f15e2963416083008e7aecdac3f7f96498f32eef37d39a8b
7
+ data.tar.gz: 7af9dcaddc5bf2f17cb8d335384c3f87eda9336fd0303f3ad8b7ec1c99bdd9c81bcec37cc7e491d77548c974a19b7abcebfc475d694f51398cb941d346fc1334
@@ -7,4 +7,3 @@ rvm:
7
7
  - 2.1.2
8
8
  - rbx-2
9
9
  - jruby-19mode
10
- - jruby-head
@@ -1,3 +1,6 @@
1
+ # 1.0.1 08/05/2014
2
+ * #14 fix issue with wrong count on bucket_span == count(..interval) - @olgen
3
+
1
4
  # 1.0.0 06/15/2014
2
5
 
3
6
 
@@ -26,6 +26,9 @@ class Ratelimit
26
26
  raise ArgumentError.new("Bucket expiry cannot be larger than the bucket span")
27
27
  end
28
28
  @bucket_count = (@bucket_span / @bucket_interval).round
29
+ if @bucket_count < 3
30
+ raise ArgumentError.new("Cannot have less than 3 buckets")
31
+ end
29
32
  @redis = options[:redis]
30
33
  end
31
34
 
@@ -1,3 +1,3 @@
1
1
  class Ratelimit
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -11,6 +11,12 @@ describe Ratelimit do
11
11
  expect(@r.instance_variable_get(:@bucket_span)).to eq(@r.instance_variable_get(:@bucket_expiry))
12
12
  end
13
13
 
14
+ it "should not allow bucket count less than 3" do
15
+ expect do
16
+ Ratelimit.new("key", {:bucket_span => 1, :bucket_interval => 1})
17
+ end.to raise_error(ArgumentError)
18
+ end
19
+
14
20
  it "should not allow bucket expiry to be larger than the bucket span" do
15
21
  expect do
16
22
  Ratelimit.new("key", {:bucket_expiry => 1200})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratelimit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - E.J. Finneran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis