rate-limit 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: b0f1786c2b5fde684e916bcc8733929b7d0d35cdc2807d8f511190f179019611
4
- data.tar.gz: c216ce4a4f8e2e479854b61b895c87d226cceba9f8a3d6fb476852709a308ed2
3
+ metadata.gz: 154d386572bd5be061f5b366b97e668ad70078b3748ca85e31a08edf2eabc4ca
4
+ data.tar.gz: 4ff16eb9e838b9a33405cd477102fd0f3d52a0fe4047ba6ddd0028e4da44ad1c
5
5
  SHA512:
6
- metadata.gz: 25bbef68dd61abd1cb2353367af910ee5d61d2ce9f1408c66a36a2741abab62bc9b3c212552e01187c5a95121c611eeb9b16232b1b1bdcc4e486fcdc780b85e0
7
- data.tar.gz: 5232a6c6f559c5161576b1f54d27a17b590c3b2d25376f8b6f0011d725dbf029bbc7b75e78d4afc6babeaea3a0acac4b9c3b643738f4e9730fbc5105241f208c
6
+ metadata.gz: b7b20463849dcc18251a7f98705465d8999670efb1861b8b59ef98140c1d60368d931b3b2723637cf1fc28f117d5b5b8474869638f6815063e3d9e9e66ccb3be
7
+ data.tar.gz: 37f15e0ef706b7740a5795ca171ea94e8591d37ec5a6923fbf92e19f08ab1b65fb1ec435d106e7c5b6cf711afcc7a407f84eba3c014536bc6d494c616111a193
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [v0.2.1] - 2022-11-09
11
+
12
+ ### Added
13
+
14
+ - https://github.com/catawiki/rate-limit/pull/28 added Integration Tests
15
+
16
+ ### Fixed
17
+
18
+ - https://github.com/catawiki/rate-limit/issues/29 Calling throttle with only_failures: true does not call success callback
19
+
20
+
10
21
  ## [v0.2.0] - 2022-10-05
11
22
 
12
23
  ### Added
@@ -65,6 +76,7 @@ and this project adheres to [Semantic Versioning].
65
76
 
66
77
  <!-- versions -->
67
78
 
68
- [Unreleased]: https://github.com/catawiki/rate-limit/compare/v0.1.0...HEAD
79
+ [Unreleased]: https://github.com/catawiki/rate-limit/compare/v0.2.1...HEAD
80
+ [v0.2.1]: https://github.com/catawiki/rate-limit/compare/v0.2.0...v0.2.1
69
81
  [v0.2.0]: https://github.com/catawiki/rate-limit/compare/v0.1.0...v0.2.0
70
82
  [v0.1.0]: https://github.com/catawiki/rate-limit/compare/v0.0.1...v0.1.0
@@ -13,8 +13,7 @@ module RateLimit
13
13
  class << self
14
14
  def raw_limits
15
15
  {
16
- RateLimit.config.default_threshold => \
17
- RateLimit.config.default_interval
16
+ RateLimit.config.default_threshold => RateLimit.config.default_interval
18
17
  }
19
18
  end
20
19
  end
@@ -7,7 +7,7 @@ module RateLimit
7
7
 
8
8
  yield if block_given?
9
9
 
10
- return success! unless only_failures
10
+ success!(skip_increment_cache: only_failures)
11
11
  rescue StandardError => e
12
12
  success! unless e.is_a?(Errors::LimitExceededError)
13
13
  raise e
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RateLimit
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -33,8 +33,8 @@ module RateLimit
33
33
  exceeded_window.present?
34
34
  end
35
35
 
36
- def success!
37
- increment_cache_counter
36
+ def success!(skip_increment_cache: false)
37
+ increment_cache_counter unless skip_increment_cache
38
38
  result.success!
39
39
  RateLimit.config.success_callback(result)
40
40
  end
data/lib/rate_limit.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/module'
3
+ require 'active_support'
4
+ require 'active_support/core_ext'
5
+
4
6
  require_relative 'rate_limit/configurable'
5
7
  require_relative 'rate_limit/result'
6
8
  require_relative 'rate_limit/cache'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rate-limit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamed Motaweh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-05 00:00:00.000000000 Z
11
+ date: 2024-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -17,9 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.2'
20
- - - "<="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 7.0.4
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +27,9 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '5.2'
30
- - - "<="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 7.0.4
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: redis
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.2.3
101
+ rubygems_version: 3.4.1
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: A Rate Limiting Gem