copy_tuner_client 0.11.0 → 0.12.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
  SHA256:
3
- metadata.gz: 8db12b6e0610b91e1722080f0c2fea2c12c5b90430cc2266974bf63822db6c94
4
- data.tar.gz: 7d6c1c2b8877738c02d6072e315311ab19c258686159534d26a421e599d1c46a
3
+ metadata.gz: 02e158d00caa261a1c3cf73b38648bde2307f5160708fcf39e7e84b542c2ecc6
4
+ data.tar.gz: ca6f9c714f15afbace17d89d3ef67a71546d5b414be83ff09e59c6b9b1974958
5
5
  SHA512:
6
- metadata.gz: 37d33371c0bb6f22939a895e66a34f2986a51cb22d84206f75e727ba40d18ab78e8e4ca9cf2aef62509a47928494420311d9b359c4479445fc32bbe8b4cafcf0
7
- data.tar.gz: 02d24f9b53dcdc5ba933789b40a5e422e04912fafa9a17122dec816893eeac77d35046a3a8fbc152b35d551e3f4b320ab4e5f38a9fe548bc10e45cc7cdb59a32
6
+ metadata.gz: ffb1ebc5fb6f78326f820527646f32eb6fcbf09c622f90d299d61a96778c27ad0954d0c8db784d96a4c93534a5eee0acb01eed824ddd1cbcee0aa5fae5cd35cc
7
+ data.tar.gz: 1ebe88eb8278fee882c0129908c562157b0ca16e6b7ac0181ae9774f53df84e5df3fcd63a843586302ab6010d369bf19d78bae8453cdc28fbf463977b8d7ede7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.12.0
2
+
3
+ - Add `config.ignored_keys` and `config.ignored_key_handler`
4
+
1
5
  ## 0.11.0
2
6
 
3
7
  - Remove deprecated rescue_format option
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- copy_tuner_client (0.11.0)
16
+ copy_tuner_client (0.12.0)
17
17
  i18n (>= 0.5.0)
18
18
  json
19
19
  nokogiri
@@ -19,7 +19,7 @@ module CopyTunerClient
19
19
  :proxy_port, :proxy_user, :secure, :polling_delay, :sync_interval,
20
20
  :sync_interval_staging, :sync_ignore_path_regex, :logger,
21
21
  :framework, :middleware, :disable_middleware, :disable_test_translation,
22
- :ca_file, :exclude_key_regexp, :s3_host, :locales].freeze
22
+ :ca_file, :exclude_key_regexp, :s3_host, :locales, :ignored_keys, :ignored_key_handler].freeze
23
23
 
24
24
  # @return [String] The API key for your project, found on the project edit form.
25
25
  attr_accessor :api_key
@@ -131,6 +131,12 @@ module CopyTunerClient
131
131
  # @return [Boolean] Html escape
132
132
  attr_accessor :html_escape
133
133
 
134
+ # @return [Array<String>] A list of ignored keys
135
+ attr_accessor :ignored_keys
136
+
137
+ # @return [Proc]
138
+ attr_accessor :ignored_key_handler
139
+
134
140
  alias_method :secure?, :secure
135
141
 
136
142
  # Instantiated from {CopyTunerClient.configure}. Sets defaults.
@@ -152,6 +158,8 @@ module CopyTunerClient
152
158
  self.s3_host = 'copy-tuner-data-prod.s3.amazonaws.com'
153
159
  self.disable_copyray_comment_injection = false
154
160
  self.html_escape = false
161
+ self.ignored_keys = []
162
+ self.ignored_key_handler = -> (e) { raise e }
155
163
 
156
164
  @applied = false
157
165
  end
@@ -9,4 +9,7 @@ module CopyTunerClient
9
9
  # server does not recognize. Polling is aborted when this error is raised.
10
10
  class InvalidApiKey < StandardError
11
11
  end
12
+
13
+ class IgnoredKey < StandardError
14
+ end
12
15
  end
@@ -65,6 +65,12 @@ module CopyTunerClient
65
65
 
66
66
  parts = I18n.normalize_keys(locale, key, scope, options[:separator])
67
67
  key_with_locale = parts.join('.')
68
+ key_without_locale = parts[1..].join('.')
69
+
70
+ if CopyTunerClient::configuration.ignored_keys.include?(key_without_locale)
71
+ CopyTunerClient::configuration.ignored_key_handler.call(IgnoredKey.new("Ignored key: #{key_without_locale}"))
72
+ end
73
+
68
74
  content = cache[key_with_locale] || super
69
75
  cache[key_with_locale] = nil if content.nil?
70
76
  content
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.11.0'.freeze
3
+ VERSION = '0.12.0'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-11 00:00:00.000000000 Z
11
+ date: 2021-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n