splitclient-rb 3.0.2 → 3.0.3.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.txt +3 -0
- data/lib/cache/repositories/splits_repository.rb +4 -0
- data/lib/splitclient-rb/split_factory.rb +48 -19
- data/lib/splitclient-rb/version.rb +1 -1
- data/splitclient-rb.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e08e6cff298e8ae24d7bcbb6053436d4c34a6ca
|
4
|
+
data.tar.gz: d0f646830d6a88634a8eb2410e0f13244d37787a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b027d1352a234b285a3cbca7b98a0a5872301826c70c466b4c37882c18349796edc12170a8e29fc09732649db4e544b1214b16e73058b323ba8373069db948e8
|
7
|
+
data.tar.gz: cf8875450e1f6cfe70fc626f10fa8fb209b9e00aeda40454e3be134b5b7453215360e5dea2be20eb0cc09f16a039bfc5b9b33e5228d52cbee5a6c1ee11f2fe19
|
data/CHANGES.txt
CHANGED
@@ -15,9 +15,10 @@ module SplitIoClient
|
|
15
15
|
# @param api_key [String] the API key for your split account
|
16
16
|
#
|
17
17
|
# @return [SplitIoManager] split.io client instance
|
18
|
-
def initialize(api_key, config = {}, adapter = nil, localhost_mode = false)
|
18
|
+
def initialize(api_key, config = {}, adapter = nil, splits_repository = nil, localhost_mode = false)
|
19
19
|
@localhost_mode_features = []
|
20
20
|
@config = config
|
21
|
+
@splits_repository = splits_repository
|
21
22
|
@localhost_mode = localhost_mode
|
22
23
|
if @localhost_mode
|
23
24
|
load_localhost_mode_features
|
@@ -47,27 +48,55 @@ module SplitIoClient
|
|
47
48
|
#
|
48
49
|
# @returns [object] array of splits
|
49
50
|
def splits
|
50
|
-
|
51
|
-
if @
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
killed: data[:killed],
|
61
|
-
treatments: treatments,
|
62
|
-
change_number: data[:changeNumber]
|
63
|
-
}
|
64
|
-
end
|
65
|
-
else
|
66
|
-
@localhost_mode_features
|
51
|
+
|
52
|
+
return @localhost_mode_features if @localhost_mode
|
53
|
+
return nil if @splits_repository.nil?
|
54
|
+
|
55
|
+
splits = @splits_repository.list_splits
|
56
|
+
ret = []
|
57
|
+
splits.keys.each do |key|
|
58
|
+
|
59
|
+
split = splits.get(key)
|
60
|
+
ret << build_split_view(key, split)
|
67
61
|
end
|
62
|
+
|
63
|
+
ret
|
68
64
|
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# method to get a split view
|
68
|
+
#
|
69
|
+
# @returns a split view
|
70
|
+
def split(split_name)
|
71
|
+
|
72
|
+
if @localhost_mode
|
73
|
+
return @localhost_mode_features.find {|x| x[:feature] == split_name}
|
74
|
+
end
|
75
|
+
|
76
|
+
if @splits_repository
|
77
|
+
|
78
|
+
split = @splits_repository.get_split(split_name)
|
79
|
+
|
80
|
+
build_split_view(split_name, split) if split
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def build_split_view(name, split)
|
85
|
+
treatments = split[:conditions] && split[:conditions][0][:partitions] \
|
86
|
+
? split[:conditions][0][:partitions].map{ |partition| partition[:treatment] }
|
87
|
+
: []
|
88
|
+
{
|
89
|
+
name: name,
|
90
|
+
traffic_type_name: split[:trafficTypeName],
|
91
|
+
killed: split[:killed],
|
92
|
+
treatments: treatments,
|
93
|
+
change_number: split[:changeNumber]
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
69
97
|
end
|
70
98
|
|
99
|
+
|
71
100
|
class SplitClient < NoMethodError
|
72
101
|
#
|
73
102
|
# constant that defines the localhost mode
|
@@ -269,7 +298,7 @@ module SplitIoClient
|
|
269
298
|
end
|
270
299
|
|
271
300
|
def init_manager
|
272
|
-
SplitManager.new(@api_key, @config, @adapter, @localhost_mode)
|
301
|
+
SplitManager.new(@api_key, @config, @adapter, @splits_repository, @localhost_mode)
|
273
302
|
end
|
274
303
|
end
|
275
304
|
end
|
data/splitclient-rb.gemspec
CHANGED
@@ -34,5 +34,5 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_runtime_dependency "faraday"
|
35
35
|
spec.add_runtime_dependency "faraday-http-cache"
|
36
36
|
spec.add_runtime_dependency "faraday_middleware"
|
37
|
-
spec.add_runtime_dependency "net-http-persistent"
|
37
|
+
spec.add_runtime_dependency "net-http-persistent", "<= 2.9.4"
|
38
38
|
end
|
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.0.
|
4
|
+
version: 3.0.3.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -210,16 +210,16 @@ dependencies:
|
|
210
210
|
name: net-http-persistent
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - "
|
213
|
+
- - "<="
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
215
|
+
version: 2.9.4
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - "
|
220
|
+
- - "<="
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
222
|
+
version: 2.9.4
|
223
223
|
description: Ruby client for using split SDK.
|
224
224
|
email:
|
225
225
|
- pato@split.io
|
@@ -293,12 +293,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
293
293
|
version: '0'
|
294
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
295
|
requirements:
|
296
|
-
- - "
|
296
|
+
- - ">"
|
297
297
|
- !ruby/object:Gem::Version
|
298
|
-
version:
|
298
|
+
version: 1.3.1
|
299
299
|
requirements: []
|
300
300
|
rubyforge_project:
|
301
|
-
rubygems_version: 2.
|
301
|
+
rubygems_version: 2.4.6
|
302
302
|
signing_key:
|
303
303
|
specification_version: 4
|
304
304
|
summary: Ruby client for split SDK.
|