splitclient-rb 6.0.1.pre.rc2-java → 6.1.0-java
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/.rubocop.yml +12 -1
- data/.simplecov +1 -0
- data/CHANGES.txt +11 -1
- data/NEWS +6 -0
- data/README.md +2 -2
- data/lib/splitclient-rb.rb +1 -0
- data/lib/splitclient-rb/clients/split_client.rb +30 -9
- data/lib/splitclient-rb/engine/api/client.rb +8 -9
- data/lib/splitclient-rb/engine/api/events.rb +4 -2
- data/lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb +10 -8
- data/lib/splitclient-rb/engine/api/impressions.rb +4 -2
- data/lib/splitclient-rb/engine/api/metrics.rb +5 -5
- data/lib/splitclient-rb/engine/api/segments.rb +5 -1
- data/lib/splitclient-rb/engine/api/splits.rb +4 -4
- data/lib/splitclient-rb/engine/matchers/all_keys_matcher.rb +8 -13
- data/lib/splitclient-rb/engine/matchers/between_matcher.rb +12 -23
- data/lib/splitclient-rb/engine/matchers/combiners.rb +3 -1
- data/lib/splitclient-rb/engine/matchers/combining_matcher.rb +16 -24
- data/lib/splitclient-rb/engine/matchers/contains_all_matcher.rb +10 -7
- data/lib/splitclient-rb/engine/matchers/contains_any_matcher.rb +7 -6
- data/lib/splitclient-rb/engine/matchers/contains_matcher.rb +19 -8
- data/lib/splitclient-rb/engine/matchers/dependency_matcher.rb +8 -3
- data/lib/splitclient-rb/engine/matchers/ends_with_matcher.rb +21 -6
- data/lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb +17 -8
- data/lib/splitclient-rb/engine/matchers/equal_to_matcher.rb +11 -23
- data/lib/splitclient-rb/engine/matchers/equal_to_set_matcher.rb +7 -6
- data/lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_matcher.rb +13 -25
- data/lib/splitclient-rb/engine/matchers/less_than_or_equal_to_matcher.rb +13 -25
- data/lib/splitclient-rb/engine/matchers/matcher.rb +30 -0
- data/lib/splitclient-rb/engine/matchers/matches_string_matcher.rb +6 -2
- data/lib/splitclient-rb/engine/matchers/negation_matcher.rb +8 -22
- data/lib/splitclient-rb/engine/matchers/part_of_set_matcher.rb +10 -7
- data/lib/splitclient-rb/engine/matchers/set_matcher.rb +7 -1
- data/lib/splitclient-rb/engine/matchers/starts_with_matcher.rb +18 -5
- data/lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb +7 -25
- data/lib/splitclient-rb/engine/matchers/whitelist_matcher.rb +33 -35
- data/lib/splitclient-rb/managers/split_manager.rb +10 -3
- data/lib/splitclient-rb/split_config.rb +34 -9
- data/lib/splitclient-rb/split_factory.rb +27 -0
- data/lib/splitclient-rb/validators.rb +104 -36
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 661e69f3559516ebb5c65685575ebba3d3fe8d41
|
4
|
+
data.tar.gz: d1d7699e033aa18b6f066fb173d9c588ded8bd98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f12227a270840990875f92fd66cdf9e4719f92f8d81fc76f752b467f3071b4c5e7b74f6f81c69af1f8965e6c235f1ddec4d31d8e25790b10a48b708ca946fb2
|
7
|
+
data.tar.gz: 90f97178d5b3dc272ee7553fd331141c35bddb3a2eadd0e2715eb8a134cbf58fccd960c7ebc7525abc6c034104dacf951e75d8e23c08f95e934fbc89cf4a5df3
|
data/.rubocop.yml
CHANGED
@@ -17,5 +17,16 @@ Naming/FileName:
|
|
17
17
|
- splitclient-rb.gemspec
|
18
18
|
|
19
19
|
AllCops:
|
20
|
+
TargetRubyVersion: 2.3.6
|
20
21
|
Exclude:
|
21
|
-
- lib
|
22
|
+
- lib/*
|
23
|
+
- lib/murmurhash/**/*
|
24
|
+
- lib/splitclient-rb/*
|
25
|
+
- lib/splitclient-rb/cache/**/*
|
26
|
+
- lib/splitclient-rb/clients/**/*
|
27
|
+
- lib/splitclient-rb/managers/**/*
|
28
|
+
- lib/splitclient-rb/engine/api/**/*
|
29
|
+
- lib/splitclient-rb/engine/evaluator/**/*
|
30
|
+
- lib/splitclient-rb/engine/metrics/**/*
|
31
|
+
- lib/splitclient-rb/engine/models/**/*
|
32
|
+
- lib/splitclient-rb/engine/parser/**/*
|
data/.simplecov
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SimpleCov.start { add_filter %r{^/spec/} }
|
data/CHANGES.txt
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
6.0
|
1
|
+
6.1.0 (Feb 8th, 2019)
|
2
|
+
- Review input validation for client API methods. Better control and logging over nil, empty, numeric, and NaN parameters
|
3
|
+
- Added logging when block_until_ready is not set or api key is not provided
|
4
|
+
- Reviewed client API methods to log an error and return nil / empty when called after client was destroyed
|
5
|
+
- Update track regex and fix an error causing a partial match to pass as a valid event_type
|
6
|
+
- Add logging to #match? in matcher subclasses
|
7
|
+
- Fix simplecov configuration issue causing errors in coverage calculation
|
8
|
+
- Improve code coverage and decrease rubocop violation count
|
9
|
+
- Fix for issue causing redis_url parameter to be ignored and Redis to always default to REDIS_ENV environment variable
|
10
|
+
|
11
|
+
6.0.1 (Jan 7th, 2019)
|
2
12
|
- Fix an issue in events and impressions API calls log messages caused by a wrong variable name introduced in 6.0.0
|
3
13
|
|
4
14
|
6.0.0 (December 17th, 2018)
|
data/NEWS
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
6.1.0
|
2
|
+
|
3
|
+
Review input validation for client API methods: get_treatment, get_treatments, track, manager. Add input validation to block_until_ready, client startup, and destroy
|
4
|
+
Add additional logging to the SDK Client in order to help debug matcher related issues
|
5
|
+
Fix for issue causing redis_url parameter to be ignored
|
6
|
+
|
1
7
|
6.0.1
|
2
8
|
|
3
9
|
Fix an issue in events and impressions API calls log messages introduced in 6.0.0
|
data/README.md
CHANGED
@@ -30,8 +30,8 @@ Split has built and maintains a SDKs for:
|
|
30
30
|
* PHP [Github](https://github.com/splitio/php-client) [Docs](http://docs.split.io/docs/php-sdk-overview)
|
31
31
|
* Python [Github](https://github.com/splitio/python-client) [Docs](http://docs.split.io/docs/python-sdk-overview)
|
32
32
|
* GO [Github](https://github.com/splitio/go-client) [Docs](http://docs.split.io/docs/go-sdk-overview)
|
33
|
-
* Android [Github](https://github.com/splitio/android-client) [Docs](https://docs.split.io/
|
34
|
-
* IOS [Github](https://github.com/splitio/ios-client) [Docs](https://docs.split.io/
|
33
|
+
* Android [Github](https://github.com/splitio/android-client) [Docs](https://docs.split.io/docs/android-sdk-overview)
|
34
|
+
* IOS [Github](https://github.com/splitio/ios-client) [Docs](https://docs.split.io/docs/ios-sdk-overview)
|
35
35
|
|
36
36
|
For a comprehensive list of opensource projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
|
37
37
|
|
data/lib/splitclient-rb.rb
CHANGED
@@ -51,6 +51,7 @@ require 'splitclient-rb/engine/parser/condition'
|
|
51
51
|
require 'splitclient-rb/engine/parser/partition'
|
52
52
|
require 'splitclient-rb/engine/parser/split_adapter'
|
53
53
|
require 'splitclient-rb/engine/parser/evaluator'
|
54
|
+
require 'splitclient-rb/engine/matchers/matcher'
|
54
55
|
require 'splitclient-rb/engine/matchers/combiners'
|
55
56
|
require 'splitclient-rb/engine/matchers/combining_matcher'
|
56
57
|
require 'splitclient-rb/engine/matchers/all_keys_matcher'
|
@@ -13,18 +13,18 @@ module SplitIoClient
|
|
13
13
|
@impressions_repository = impressions_repository
|
14
14
|
@metrics_repository = metrics_repository
|
15
15
|
@events_repository = events_repository
|
16
|
+
@destroyed = false
|
16
17
|
|
17
18
|
@adapter = adapter
|
18
19
|
end
|
19
20
|
|
20
21
|
def get_treatments(key, split_names, attributes = {})
|
21
|
-
|
22
22
|
return nil unless SplitIoClient::Validators.valid_get_treatments_parameters(split_names)
|
23
23
|
|
24
24
|
sanitized_split_names = sanitize_split_names(split_names)
|
25
25
|
|
26
26
|
if sanitized_split_names.empty?
|
27
|
-
SplitIoClient.configuration.logger.
|
27
|
+
SplitIoClient.configuration.logger.error('get_treatments: split_names must be a non-empty Array')
|
28
28
|
return {}
|
29
29
|
end
|
30
30
|
|
@@ -73,15 +73,23 @@ module SplitIoClient
|
|
73
73
|
key, split_name, attributes = {}, split_data = nil, store_impressions = true,
|
74
74
|
multiple = false, evaluator = nil
|
75
75
|
)
|
76
|
+
|
76
77
|
control_treatment = { label: Engine::Models::Label::EXCEPTION, treatment: SplitIoClient::Engine::Models::Treatment::CONTROL }
|
77
78
|
parsed_control_treatment = parsed_treatment(multiple, control_treatment)
|
78
79
|
|
79
80
|
bucketing_key, matching_key = keys_from_key(key)
|
80
81
|
|
81
|
-
return parsed_control_treatment unless SplitIoClient::Validators.valid_get_treatment_parameters(key, split_name, matching_key, bucketing_key)
|
82
|
+
return parsed_control_treatment unless valid_client && SplitIoClient::Validators.valid_get_treatment_parameters(key, split_name, matching_key, bucketing_key, attributes)
|
82
83
|
|
83
84
|
bucketing_key = bucketing_key ? bucketing_key.to_s : nil
|
84
85
|
matching_key = matching_key.to_s
|
86
|
+
sanitized_split_name = split_name.to_s.strip
|
87
|
+
|
88
|
+
if split_name.to_s != sanitized_split_name
|
89
|
+
SplitIoClient.configuration.logger.warn("get_treatment: split_name #{split_name} has extra whitespace, trimming")
|
90
|
+
split_name = sanitized_split_name
|
91
|
+
end
|
92
|
+
|
85
93
|
evaluator ||= Engine::Parser::Evaluator.new(@segments_repository, @splits_repository)
|
86
94
|
|
87
95
|
begin
|
@@ -117,18 +125,18 @@ module SplitIoClient
|
|
117
125
|
|
118
126
|
def destroy
|
119
127
|
SplitIoClient.configuration.logger.info('Split client shutdown started...') if SplitIoClient.configuration.debug_enabled
|
120
|
-
|
121
128
|
SplitIoClient.configuration.threads[:impressions_sender].raise(SplitIoClient::ImpressionShutdownException)
|
122
129
|
SplitIoClient.configuration.threads.reject { |k, _| k == :impressions_sender }.each do |name, thread|
|
123
130
|
Thread.kill(thread)
|
124
131
|
end
|
125
|
-
|
126
132
|
@metrics_repository.clear
|
127
133
|
@splits_repository.clear
|
128
134
|
@segments_repository.clear
|
129
135
|
@events_repository.clear
|
130
136
|
|
131
137
|
SplitIoClient.configuration.logger.info('Split client shutdown complete') if SplitIoClient.configuration.debug_enabled
|
138
|
+
SplitIoClient.configuration.valid_mode = false
|
139
|
+
@destroyed = true
|
132
140
|
end
|
133
141
|
|
134
142
|
def store_impression(split_name, matching_key, bucketing_key, treatment, store_impressions, attributes)
|
@@ -177,9 +185,9 @@ module SplitIoClient
|
|
177
185
|
end
|
178
186
|
|
179
187
|
def track(key, traffic_type_name, event_type, value = nil)
|
180
|
-
return false unless SplitIoClient::Validators.valid_track_parameters(key, traffic_type_name, event_type, value)
|
188
|
+
return false unless valid_client && SplitIoClient::Validators.valid_track_parameters(key, traffic_type_name, event_type, value)
|
181
189
|
begin
|
182
|
-
@events_repository.add(key.to_s, traffic_type_name, event_type.to_s, (Time.now.to_f * 1000).to_i, value)
|
190
|
+
@events_repository.add(key.to_s, traffic_type_name.downcase, event_type.to_s, (Time.now.to_f * 1000).to_i, value)
|
183
191
|
true
|
184
192
|
rescue StandardError => error
|
185
193
|
SplitIoClient.configuration.log_found_exception(__method__.to_s, error)
|
@@ -210,13 +218,26 @@ module SplitIoClient
|
|
210
218
|
|
211
219
|
def sanitize_split_names(split_names)
|
212
220
|
split_names.compact.uniq.select do |split_name|
|
213
|
-
if split_name.is_a?(String) && !split_name.empty?
|
221
|
+
if (split_name.is_a?(String) || split_name.is_a?(Symbol)) && !split_name.empty?
|
214
222
|
true
|
223
|
+
elsif split_name.is_a?(String) && split_name.empty?
|
224
|
+
SplitIoClient.configuration.logger.warn('get_treatments: you passed an empty split_name, split_name must be a non-empty String or a Symbol')
|
225
|
+
false
|
215
226
|
else
|
216
|
-
SplitIoClient.configuration.logger.warn('get_treatments: split_name
|
227
|
+
SplitIoClient.configuration.logger.warn('get_treatments: you passed an invalid split_name, split_name must be a non-empty String or a Symbol')
|
217
228
|
false
|
218
229
|
end
|
219
230
|
end
|
220
231
|
end
|
232
|
+
|
233
|
+
private
|
234
|
+
|
235
|
+
def valid_client
|
236
|
+
if @destroyed
|
237
|
+
SplitIoClient.configuration.logger.error('Client has already been destroyed - no calls possible')
|
238
|
+
return false
|
239
|
+
end
|
240
|
+
SplitIoClient.configuration.valid_mode
|
241
|
+
end
|
221
242
|
end
|
222
243
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'net/http/persistent'
|
2
4
|
|
3
5
|
module SplitIoClient
|
@@ -12,7 +14,7 @@ module SplitIoClient
|
|
12
14
|
req.options[:timeout] = SplitIoClient.configuration.read_timeout
|
13
15
|
req.options[:open_timeout] = SplitIoClient.configuration.connection_timeout
|
14
16
|
|
15
|
-
|
17
|
+
SplitLogger.log_if_debug("GET #{url} proxy: #{api_client.proxy}")
|
16
18
|
end
|
17
19
|
rescue StandardError => e
|
18
20
|
SplitIoClient.configuration.logger.warn("#{e}\nURL:#{url}\nparams:#{params}")
|
@@ -22,23 +24,20 @@ module SplitIoClient
|
|
22
24
|
def post_api(url, api_key, data, headers = {}, params = {})
|
23
25
|
api_client.post(url) do |req|
|
24
26
|
req.headers = common_headers(api_key)
|
25
|
-
|
26
|
-
|
27
|
+
.merge('Content-Type' => 'application/json')
|
28
|
+
.merge(headers)
|
27
29
|
|
28
30
|
req.body = data.to_json
|
29
31
|
|
30
32
|
req.options[:timeout] = SplitIoClient.configuration.read_timeout
|
31
33
|
req.options[:open_timeout] = SplitIoClient.configuration.connection_timeout
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
elsif SplitIoClient.configuration.debug_enabled
|
36
|
-
SplitIoClient.configuration.logger.debug("POST #{url}")
|
37
|
-
end
|
35
|
+
SplitLogger.log_if_transport("POST #{url} #{req.body}")
|
36
|
+
SplitLogger.log_if_debug("POST #{url}")
|
38
37
|
end
|
39
38
|
rescue StandardError => e
|
40
39
|
SplitIoClient.configuration.logger.warn("#{e}\nURL:#{url}\ndata:#{data}\nparams:#{params}")
|
41
|
-
raise 'Split SDK failed to connect to backend to
|
40
|
+
raise 'Split SDK failed to connect to backend to post information'
|
42
41
|
end
|
43
42
|
|
44
43
|
private
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SplitIoClient
|
2
4
|
module Api
|
3
5
|
class Events < Client
|
@@ -7,7 +9,7 @@ module SplitIoClient
|
|
7
9
|
|
8
10
|
def post(events)
|
9
11
|
if events.empty?
|
10
|
-
|
12
|
+
SplitLogger.log_if_debug('No events to report')
|
11
13
|
return
|
12
14
|
end
|
13
15
|
|
@@ -25,7 +27,7 @@ module SplitIoClient
|
|
25
27
|
SplitLogger.log_if_debug("Events reported: #{events_slice.size}")
|
26
28
|
else
|
27
29
|
SplitLogger.log_error("Unexpected status code while posting events: #{response.status}." \
|
28
|
-
|
30
|
+
' - Check your API key and base URI')
|
29
31
|
raise 'Split SDK failed to connect to backend to post events'
|
30
32
|
end
|
31
33
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
|
3
5
|
module SplitIoClient
|
4
6
|
module FaradayMiddleware
|
5
7
|
class Gzip < Faraday::Middleware
|
6
|
-
ACCEPT_ENCODING = 'Accept-Encoding'
|
7
|
-
CONTENT_ENCODING = 'Content-Encoding'
|
8
|
-
CONTENT_LENGTH = 'Content-Length'
|
9
|
-
SUPPORTED_ENCODINGS = 'gzip,deflate'
|
8
|
+
ACCEPT_ENCODING = 'Accept-Encoding'
|
9
|
+
CONTENT_ENCODING = 'Content-Encoding'
|
10
|
+
CONTENT_LENGTH = 'Content-Length'
|
11
|
+
SUPPORTED_ENCODINGS = 'gzip,deflate'
|
10
12
|
RUBY_ENCODING = '1.9'.respond_to?(:force_encoding)
|
11
13
|
|
12
14
|
def call(env)
|
@@ -30,10 +32,10 @@ module SplitIoClient
|
|
30
32
|
def uncompress_gzip(body)
|
31
33
|
io = StringIO.new(body)
|
32
34
|
gzip_reader = if RUBY_ENCODING
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
Zlib::GzipReader.new(io, encoding: 'ASCII-8BIT')
|
36
|
+
else
|
37
|
+
Zlib::GzipReader.new(io)
|
38
|
+
end
|
37
39
|
gzip_reader.read
|
38
40
|
end
|
39
41
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SplitIoClient
|
2
4
|
module Api
|
3
5
|
class Impressions < Client
|
@@ -7,7 +9,7 @@ module SplitIoClient
|
|
7
9
|
|
8
10
|
def post(impressions)
|
9
11
|
if impressions.empty?
|
10
|
-
|
12
|
+
SplitLogger.log_if_debug('No impressions to report')
|
11
13
|
return
|
12
14
|
end
|
13
15
|
|
@@ -18,7 +20,7 @@ module SplitIoClient
|
|
18
20
|
SplitLogger.log_if_debug("Impressions reported: #{total_impressions(impressions)}")
|
19
21
|
else
|
20
22
|
SplitLogger.log_error("Unexpected status code while posting impressions: #{response.status}." \
|
21
|
-
|
23
|
+
' - Check your API key and base URI')
|
22
24
|
raise 'Split SDK failed to connect to backend to post impressions'
|
23
25
|
end
|
24
26
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SplitIoClient
|
2
4
|
module Api
|
3
5
|
class Metrics < Client
|
@@ -15,7 +17,7 @@ module SplitIoClient
|
|
15
17
|
|
16
18
|
def post_latencies
|
17
19
|
if @metrics_repository.latencies.empty?
|
18
|
-
|
20
|
+
SplitLogger.log_if_debug('No latencies to report.')
|
19
21
|
else
|
20
22
|
@metrics_repository.latencies.each do |name, latencies|
|
21
23
|
metrics_time = { name: name, latencies: latencies }
|
@@ -31,7 +33,7 @@ module SplitIoClient
|
|
31
33
|
|
32
34
|
def post_counts
|
33
35
|
if @metrics_repository.counts.empty?
|
34
|
-
|
36
|
+
SplitLogger.log_if_debug('No counts to report.')
|
35
37
|
else
|
36
38
|
@metrics_repository.counts.each do |name, count|
|
37
39
|
metrics_count = { name: name, delta: count }
|
@@ -44,14 +46,12 @@ module SplitIoClient
|
|
44
46
|
@metrics_repository.clear_counts
|
45
47
|
end
|
46
48
|
|
47
|
-
private
|
48
|
-
|
49
49
|
def log_status(response, info_to_log)
|
50
50
|
if response.success?
|
51
51
|
SplitLogger.log_if_debug("Metric time reported: #{info_to_log}")
|
52
52
|
else
|
53
53
|
SplitLogger.log_error("Unexpected status code while posting time metrics: #{response.status}" \
|
54
|
-
|
54
|
+
' - Check your API key and base URI')
|
55
55
|
raise 'Split SDK failed to connect to backend to post metrics'
|
56
56
|
end
|
57
57
|
end
|
@@ -27,6 +27,7 @@ module SplitIoClient
|
|
27
27
|
till: #{@segments_repository.get_change_number(name)}")
|
28
28
|
|
29
29
|
break if since.to_i >= @segments_repository.get_change_number(name).to_i
|
30
|
+
|
30
31
|
since = @segments_repository.get_change_number(name)
|
31
32
|
end
|
32
33
|
end
|
@@ -39,7 +40,6 @@ module SplitIoClient
|
|
39
40
|
|
40
41
|
def fetch_segment_changes(name, since)
|
41
42
|
response = get_api("#{SplitIoClient.configuration.base_uri}/segmentChanges/#{name}", @api_key, since: since)
|
42
|
-
|
43
43
|
if response.success?
|
44
44
|
segment = JSON.parse(response.body, symbolize_names: true)
|
45
45
|
@segments_repository.set_change_number(name, segment[:till])
|
@@ -55,6 +55,10 @@ module SplitIoClient
|
|
55
55
|
SplitLogger.log_if_transport(segment.to_s)
|
56
56
|
|
57
57
|
segment
|
58
|
+
elsif response.status == 403
|
59
|
+
SplitIoClient.configuration.logger.error('Factory Instantiation: You passed a browser type api_key, ' \
|
60
|
+
'please grab an api key from the Split console that is of type sdk')
|
61
|
+
SplitIoClient.configuration.valid_mode = false
|
58
62
|
else
|
59
63
|
SplitLogger.log_error("Unexpected status code while fetching segments: #{response.status}." \
|
60
64
|
"Since #{since} - Check your API key and base URI")
|
@@ -30,10 +30,10 @@ module SplitIoClient
|
|
30
30
|
|
31
31
|
result
|
32
32
|
else
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
@metrics.count(METRICS_PREFIX + '.status.' + response.status.to_s, 1)
|
34
|
+
SplitLogger.log_error("Unexpected status code while fetching splits: #{response.status}. " \
|
35
|
+
'Check your API key and base URI')
|
36
|
+
raise 'Split SDK failed to connect to backend to fetch split definitions'
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -1,15 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SplitIoClient
|
2
4
|
#
|
3
5
|
# class to implement the all keys matcher
|
4
6
|
#
|
5
|
-
class AllKeysMatcher
|
6
|
-
MATCHER_TYPE = 'ALL_KEYS'
|
7
|
+
class AllKeysMatcher < Matcher
|
8
|
+
MATCHER_TYPE = 'ALL_KEYS'
|
7
9
|
|
8
10
|
#
|
9
11
|
# evaluates if the key matches the matcher
|
10
12
|
#
|
11
13
|
# @return [boolean] true for all instances
|
12
14
|
def match?(_args)
|
15
|
+
SplitLogger.log_if_debug('[AllKeysMatcher] is always -> true')
|
13
16
|
true
|
14
17
|
end
|
15
18
|
|
@@ -20,25 +23,17 @@ module SplitIoClient
|
|
20
23
|
#
|
21
24
|
# @return [boolean] true if obj equals the matcher
|
22
25
|
def equals?(obj)
|
23
|
-
if obj.
|
24
|
-
false
|
25
|
-
elsif equal?(obj)
|
26
|
+
if obj.instance_of?(AllKeysMatcher)
|
26
27
|
true
|
27
|
-
elsif !obj.instance_of?(AllKeysMatcher)
|
28
|
-
false
|
29
28
|
else
|
30
|
-
|
29
|
+
super(obj)
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
|
-
def string_type?
|
35
|
-
false
|
36
|
-
end
|
37
|
-
|
38
33
|
#
|
39
34
|
# function to print string value for this matcher
|
40
35
|
#
|
41
|
-
# @
|
36
|
+
# @return [string] string value of this matcher
|
42
37
|
def to_s
|
43
38
|
'in segment all'
|
44
39
|
end
|