nexaas-throttle 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f56136a362918eb1468dbe7e0ba6b51c3f74c047
4
- data.tar.gz: 3a5c43b886faa83d35cbd1501a5367d6a9da1d3f
3
+ metadata.gz: 239db002ccd08f97b093b62ac0769c8febb3781f
4
+ data.tar.gz: dc712921f451ec379ffba1d71d5321dea329f592
5
5
  SHA512:
6
- metadata.gz: 4c5fe3080a4613d73281f30a45e26520b3de6f36c2944fa1ae196333c8407ccd7754f65d2ffa4812792bcaa6767f2ba77451fe26a7cefd70ba61d5de99742d0e
7
- data.tar.gz: 5d815288a6a313a0f2e1c585bcf073e5b12d3ff863c770eda71d0c7695e945ae848858665a34b0cdc6948a8e4e54233803941451a0ee174812ece2cf4117da91
6
+ metadata.gz: 04b82f2bddc6be8464287e23d6bd4eadee2382ceb6eb53a233b11696d280b14b89fdcf86b254b8a50109f5d9dcb340f183e460cda2658c8a9a603ebd073cf91b
7
+ data.tar.gz: a1c58b5330e94c33fb306ade160ab3e36aca9f237d49a027a62cdb1d0f8bb30bbc1703d0baee7f18cdc56fd2e8c367e2a2d55f33fa98b3227033a7a77f0c84d4
data/README.md CHANGED
@@ -41,6 +41,7 @@ Nexaas::Throttle.configure do |config|
41
41
  db: 0,
42
42
  namespace: "nexaas:throttle"
43
43
  }
44
+  config.ignored_user_agents = [/[Gg]oogle/, /Amazon/]
44
45
  end
45
46
  ```
46
47
 
@@ -38,7 +38,7 @@ module Nexaas
38
38
  attr_reader :redis_options
39
39
 
40
40
  # Ignores how many User-Agent the application wants, in case of other applications from the same organization.
41
- # Example: ["Google", "Amazons"]
41
+ # Example: [/[Gg]oogle/, /Amazon/]
42
42
  # @return [Array]
43
43
  attr_accessor :ignored_user_agents
44
44
 
@@ -45,7 +45,7 @@ module Nexaas
45
45
  end
46
46
 
47
47
  def ignore_user_agents?
48
- ignored_user_agents && ignored_user_agents.include?(request.user_agent)
48
+ ignored_user_agents && !ignored_user_agents.map { |regexp| regexp.match(request.user_agent) }.compact.blank?
49
49
  end
50
50
  end
51
51
  end
@@ -1,5 +1,5 @@
1
1
  module Nexaas
2
2
  module Throttle
3
- VERSION = "0.2.0".freeze
3
+ VERSION = "1.0.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexaas-throttle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wanderson Policarpo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 2.5.2
185
+ rubygems_version: 2.6.10
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: A tiny engine to allow throttling and blacklisting requests.