splitclient-rb 3.2.4.pre.rc3 → 3.2.4.pre.rc4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fcfc0670fd1ea2517cd392450ec947e25f8ae4d
|
4
|
+
data.tar.gz: d999ecfac859bf65b85b25dc9f3ab3b485bb9170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e00571074cf289db886f2504c39c49e66a540328be0707be24e1c728cdb6f8139867ff3d558cc89e466575e88a4462df3d7556491e07837a9de876143a600f
|
7
|
+
data.tar.gz: 9f0322943f9a3c300b6411e471abf8d029e8dedf4e1f3a68aee66222d42e0c99d93080f3618e06fb33c068fc563e2a158173eb8e6c222eef7f00553349b57b6b
|
data/CHANGES.txt
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
- Allow passing non-string values to get_treatment/get_treatments
|
5
5
|
- Better logging when returning CONTROL and label:Exception as well as when restarting threads
|
6
6
|
- Add exception logging when failed to clear impressions keys or fetch impressions keys
|
7
|
+
- Fix Redis naming issues (key_name -> keyName)
|
8
|
+
- Fix negation matcher
|
7
9
|
|
8
10
|
3.2.3
|
9
11
|
- Fix Redis namespace issue to align with the spec
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module SplitIoClient
|
2
|
-
|
3
2
|
#
|
4
3
|
# class to implement the all keys matcher
|
5
4
|
#
|
6
5
|
class AllKeysMatcher < NoMethodError
|
7
|
-
|
8
6
|
attr_reader :matcher_type
|
9
7
|
|
10
8
|
def initialize
|
11
|
-
@matcher_type =
|
9
|
+
@matcher_type = 'ALL_KEYS'
|
12
10
|
end
|
13
11
|
|
14
12
|
#
|
@@ -17,7 +15,7 @@ module SplitIoClient
|
|
17
15
|
# @param key [string] key value to be matched
|
18
16
|
#
|
19
17
|
# @return [boolean] true for all instances
|
20
|
-
def match?(
|
18
|
+
def match?(_key, _attributes)
|
21
19
|
true
|
22
20
|
end
|
23
21
|
|
@@ -30,7 +28,7 @@ module SplitIoClient
|
|
30
28
|
def equals?(obj)
|
31
29
|
if obj.nil?
|
32
30
|
false
|
33
|
-
elsif
|
31
|
+
elsif equal?(obj)
|
34
32
|
true
|
35
33
|
elsif !obj.instance_of?(AllKeysMatcher)
|
36
34
|
false
|
@@ -46,7 +44,5 @@ module SplitIoClient
|
|
46
44
|
def to_s
|
47
45
|
'in segment all'
|
48
46
|
end
|
49
|
-
|
50
47
|
end
|
51
|
-
|
52
48
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module SplitIoClient
|
2
|
-
|
3
2
|
#
|
4
3
|
# acts as dto for a condition structure
|
5
4
|
#
|
6
5
|
class Condition < NoMethodError
|
7
|
-
|
8
6
|
#
|
9
7
|
# definition of the condition
|
10
8
|
#
|
@@ -16,7 +14,7 @@ module SplitIoClient
|
|
16
14
|
@partitions = set_partitions
|
17
15
|
end
|
18
16
|
|
19
|
-
def create_condition_matcher
|
17
|
+
def create_condition_matcher(matchers)
|
20
18
|
CombiningMatcher.new(combiner, matchers) unless combiner.nil?
|
21
19
|
end
|
22
20
|
|
@@ -38,20 +36,24 @@ module SplitIoClient
|
|
38
36
|
@data[:matcherGroup][:matchers]
|
39
37
|
end
|
40
38
|
|
41
|
-
def
|
42
|
-
|
39
|
+
def negation_matcher(matcher)
|
40
|
+
NegationMatcher.new(matcher)
|
43
41
|
end
|
44
42
|
|
45
|
-
|
46
|
-
|
43
|
+
def matcher_all_keys(_params)
|
44
|
+
@matcher_all_keys ||= AllKeysMatcher.new
|
45
|
+
end
|
46
|
+
|
47
|
+
# returns UserDefinedSegmentMatcher[object]
|
48
|
+
def matcher_in_segment(params)
|
47
49
|
matcher = params[:matcher]
|
48
50
|
segment_name = matcher[:userDefinedSegmentMatcherData] && matcher[:userDefinedSegmentMatcherData][:segmentName]
|
49
51
|
|
50
52
|
UserDefinedSegmentMatcher.new(params[:segments_repository], segment_name)
|
51
53
|
end
|
52
54
|
|
53
|
-
#returns WhitelistMatcher[object] the whitelist for this condition in case it has a whitelist matcher
|
54
|
-
def matcher_whitelist
|
55
|
+
# returns WhitelistMatcher[object] the whitelist for this condition in case it has a whitelist matcher
|
56
|
+
def matcher_whitelist(params)
|
55
57
|
result = nil
|
56
58
|
matcher = params[:matcher]
|
57
59
|
is_user_whitelist = ((matcher[:keySelector]).nil? || (matcher[:keySelector])[:attribute].nil?)
|
@@ -60,42 +62,42 @@ module SplitIoClient
|
|
60
62
|
else
|
61
63
|
attribute = (matcher[:keySelector])[:attribute]
|
62
64
|
white_list = (matcher[:whitelistMatcherData])[:whitelist]
|
63
|
-
result = {attribute: attribute, value: white_list}
|
65
|
+
result = { attribute: attribute, value: white_list }
|
64
66
|
end
|
65
67
|
WhitelistMatcher.new(result)
|
66
68
|
end
|
67
69
|
|
68
|
-
def matcher_equal_to
|
70
|
+
def matcher_equal_to(params)
|
69
71
|
matcher = params[:matcher]
|
70
72
|
attribute = (matcher[:keySelector])[:attribute]
|
71
73
|
value = (matcher[:unaryNumericMatcherData])[:value]
|
72
74
|
data_type = (matcher[:unaryNumericMatcherData])[:dataType]
|
73
|
-
EqualToMatcher.new(
|
75
|
+
EqualToMatcher.new(attribute: attribute, value: value, data_type: data_type)
|
74
76
|
end
|
75
77
|
|
76
|
-
def matcher_greater_than_or_equal_to
|
78
|
+
def matcher_greater_than_or_equal_to(params)
|
77
79
|
matcher = params[:matcher]
|
78
80
|
attribute = (matcher[:keySelector])[:attribute]
|
79
81
|
value = (matcher[:unaryNumericMatcherData])[:value]
|
80
82
|
data_type = (matcher[:unaryNumericMatcherData])[:dataType]
|
81
|
-
GreaterThanOrEqualToMatcher.new(
|
83
|
+
GreaterThanOrEqualToMatcher.new(attribute: attribute, value: value, data_type: data_type)
|
82
84
|
end
|
83
85
|
|
84
|
-
def matcher_less_than_or_equal_to
|
86
|
+
def matcher_less_than_or_equal_to(params)
|
85
87
|
matcher = params[:matcher]
|
86
88
|
attribute = (matcher[:keySelector])[:attribute]
|
87
89
|
value = (matcher[:unaryNumericMatcherData])[:value]
|
88
90
|
data_type = (matcher[:unaryNumericMatcherData])[:dataType]
|
89
|
-
LessThanOrEqualToMatcher.new(
|
91
|
+
LessThanOrEqualToMatcher.new(attribute: attribute, value: value, data_type: data_type)
|
90
92
|
end
|
91
93
|
|
92
|
-
def matcher_between
|
94
|
+
def matcher_between(params)
|
93
95
|
matcher = params[:matcher]
|
94
96
|
attribute = (matcher[:keySelector])[:attribute]
|
95
97
|
start_value = (matcher[:betweenMatcherData])[:start]
|
96
98
|
end_value = (matcher[:betweenMatcherData])[:end]
|
97
99
|
data_type = (matcher[:betweenMatcherData])[:dataType]
|
98
|
-
BetweenMatcher.new(
|
100
|
+
BetweenMatcher.new(attribute: attribute, start_value: start_value, end_value: end_value, data_type: data_type)
|
99
101
|
end
|
100
102
|
|
101
103
|
#
|
@@ -106,9 +108,7 @@ module SplitIoClient
|
|
106
108
|
|
107
109
|
#
|
108
110
|
# @return [object] the array of partitions for this condition
|
109
|
-
|
110
|
-
@partitions
|
111
|
-
end
|
111
|
+
attr_reader :partitions
|
112
112
|
|
113
113
|
#
|
114
114
|
# converts the partitions hash for this condition into an array of partition objects
|
@@ -46,10 +46,11 @@ module SplitIoClient
|
|
46
46
|
|
47
47
|
@segments_repository.adapter.pipelined do
|
48
48
|
condition.matchers.each do |matcher|
|
49
|
-
matchers <<
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
matchers << if matcher[:negate]
|
50
|
+
condition.negation_matcher(matcher_instance(matcher[:matcherType], condition, matcher))
|
51
|
+
else
|
52
|
+
matcher_instance(matcher[:matcherType], condition, matcher)
|
53
|
+
end
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
@@ -65,6 +66,13 @@ module SplitIoClient
|
|
65
66
|
def treatment(label, treatment, change_number = nil)
|
66
67
|
{ label: label, treatment: treatment, change_number: change_number }
|
67
68
|
end
|
69
|
+
|
70
|
+
def matcher_instance(type, condition, matcher)
|
71
|
+
condition.send(
|
72
|
+
"matcher_#{type.downcase}",
|
73
|
+
matcher: matcher, segments_repository: @segments_repository
|
74
|
+
)
|
75
|
+
end
|
68
76
|
end
|
69
77
|
end
|
70
78
|
end
|
@@ -85,12 +85,12 @@ module SplitIoClient
|
|
85
85
|
if @config.impressions_queue_size > 0 && store_impressions && split
|
86
86
|
# Disable impressions if @config.impressions_queue_size == -1
|
87
87
|
@impressions_repository.add(split_name,
|
88
|
-
'
|
89
|
-
'
|
88
|
+
'keyName' => matching_key,
|
89
|
+
'bucketingKey' => bucketing_key,
|
90
90
|
'treatment' => treatment_label_change_number[:treatment],
|
91
91
|
'label' => @config.labels_enabled ? treatment_label_change_number[:label] : nil,
|
92
92
|
'time' => (Time.now.to_f * 1000.0).to_i,
|
93
|
-
'
|
93
|
+
'changeNumber' => treatment_label_change_number[:change_number]
|
94
94
|
)
|
95
95
|
end
|
96
96
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.4.pre.
|
4
|
+
version: 3.2.4.pre.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|