ldclient-rb 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +8 -3
- data/lib/ldclient-rb/stream.rb +5 -3
- data/lib/ldclient-rb/version.rb +1 -1
- data/spec/stream_spec.rb +2 -2
- metadata +33 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 238b1aa2f0ad4188eb0f393cde367276224a97f9
|
4
|
+
data.tar.gz: 8651d4e965420a5e8bf6f463c8c9ade30c6a7cb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c56792c832ad9e8a65006d6617136b1c01f41064465d87e4952ed3d4dd3a92cd276d2a02b457058aa01b8d80b29815f63b33d415aa8ac0b34e07e3b90f9479d
|
7
|
+
data.tar.gz: cd862bbf005730031147eb389f51fbbc3ce48c2e30949177bf5795bc5f1ac8a7c22dc6e27599eeb8fb0050b63038635dc71f13f07f89bfdb3d456ac85d5b4bac
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
All notable changes to the LaunchDarkly Ruby SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
|
4
4
|
|
5
|
+
## [2.0.3] - 2016-10-21
|
6
|
+
## Fixed
|
7
|
+
- Indirect stream events are now correctly processed
|
8
|
+
|
9
|
+
## [2.0.2] - 2016-08-08
|
10
|
+
## Changed
|
11
|
+
- The default logger now logs at `info` level
|
12
|
+
|
5
13
|
## [2.0.0] - 2016-08-08
|
6
14
|
### Added
|
7
15
|
- Support for multivariate feature flags. In addition to booleans, feature flags can now return numbers, strings, dictionaries, or arrays via the `variation` method.
|
data/README.md
CHANGED
@@ -71,7 +71,7 @@ Rails.configuration.ld_client = LaunchDarkly::LDClient.new("your_sdk_key")
|
|
71
71
|
3. In your controllers, access the client using
|
72
72
|
|
73
73
|
```ruby
|
74
|
-
Rails.application.config.ld_client.
|
74
|
+
Rails.application.config.ld_client.variation('your.flag.key', launchdarkly_settings, false)
|
75
75
|
```
|
76
76
|
|
77
77
|
Note that this gem will automatically switch to using the Rails logger it is detected.
|
@@ -83,7 +83,7 @@ Your first feature flag
|
|
83
83
|
2. In your application code, use the feature's key to check whether the flag is on for each user:
|
84
84
|
|
85
85
|
```ruby
|
86
|
-
if client.
|
86
|
+
if client.variation("your.flag.key", {key: "user@test.com"}, false)
|
87
87
|
# application code to show the feature
|
88
88
|
else
|
89
89
|
# the code to run if the feature is off
|
@@ -93,7 +93,12 @@ end
|
|
93
93
|
Learn more
|
94
94
|
-----------
|
95
95
|
|
96
|
-
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/
|
96
|
+
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/ruby-sdk-reference).
|
97
|
+
|
98
|
+
Testing
|
99
|
+
-------
|
100
|
+
|
101
|
+
We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.
|
97
102
|
|
98
103
|
Contributing
|
99
104
|
------------
|
data/lib/ldclient-rb/stream.rb
CHANGED
@@ -47,24 +47,26 @@ module LaunchDarkly
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def process_message(message, method)
|
50
|
-
message = JSON.parse(message.data, symbolize_names: true)
|
51
50
|
@config.logger.debug("[LDClient] Stream received #{method} message")
|
52
51
|
if method == PUT
|
52
|
+
message = JSON.parse(message.data, symbolize_names: true)
|
53
53
|
@store.init(message)
|
54
54
|
@initialized.make_true
|
55
55
|
@config.logger.info("[LDClient] Stream initialized")
|
56
56
|
elsif method == PATCH
|
57
|
+
message = JSON.parse(message.data, symbolize_names: true)
|
57
58
|
@store.upsert(message[:path][1..-1], message[:data])
|
58
59
|
elsif method == DELETE
|
60
|
+
message = JSON.parse(message.data, symbolize_names: true)
|
59
61
|
@store.delete(message[:path][1..-1], message[:version])
|
60
62
|
elsif method == INDIRECT_PUT
|
61
63
|
@store.init(@requestor.request_all_flags)
|
62
64
|
@initialized.make_true
|
63
65
|
@config.logger.info("[LDClient] Stream initialized (via indirect message)")
|
64
66
|
elsif method == INDIRECT_PATCH
|
65
|
-
@store.upsert(@requestor.request_flag(message
|
67
|
+
@store.upsert(message.data, @requestor.request_flag(message.data))
|
66
68
|
else
|
67
|
-
@config.logger.
|
69
|
+
@config.logger.warn("[LDClient] Unknown message received: #{method}")
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
data/lib/ldclient-rb/version.rb
CHANGED
data/spec/stream_spec.rb
CHANGED
@@ -53,8 +53,8 @@ describe LaunchDarkly::StreamProcessor do
|
|
53
53
|
processor.send(:process_message, delete_message, LaunchDarkly::DELETE)
|
54
54
|
expect(processor.instance_variable_get(:@store).get("key")).to eq(nil)
|
55
55
|
end
|
56
|
-
it "will log
|
57
|
-
expect(processor.instance_variable_get(:@config).logger).to receive :
|
56
|
+
it "will log a warning if the method is not recognized" do
|
57
|
+
expect(processor.instance_variable_get(:@config).logger).to receive :warn
|
58
58
|
processor.send(:process_message, put_message, "get")
|
59
59
|
end
|
60
60
|
end
|
metadata
CHANGED
@@ -1,181 +1,181 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ldclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: codeclimate-test-reporter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.8'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: faraday
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.9'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: faraday-http-cache
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 1.3.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 1.3.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: thread_safe
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.3'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.3'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: net-http-persistent
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2.9'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.9'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: concurrent-ruby
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 1.0.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 1.0.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: hashdiff
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0.2'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - ~>
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0.2'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: ld-celluloid-eventsource
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - ~>
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0.5'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.5'
|
181
181
|
- !ruby/object:Gem::Dependency
|
@@ -200,11 +200,11 @@ extensions:
|
|
200
200
|
- ext/mkrf_conf.rb
|
201
201
|
extra_rdoc_files: []
|
202
202
|
files:
|
203
|
-
- .gitignore
|
204
|
-
- .hound.yml
|
205
|
-
- .rspec
|
206
|
-
- .rubocop.yml
|
207
|
-
- .simplecov
|
203
|
+
- ".gitignore"
|
204
|
+
- ".hound.yml"
|
205
|
+
- ".rspec"
|
206
|
+
- ".rubocop.yml"
|
207
|
+
- ".simplecov"
|
208
208
|
- CHANGELOG.md
|
209
209
|
- CONTRIBUTING.md
|
210
210
|
- Gemfile
|
@@ -247,12 +247,12 @@ require_paths:
|
|
247
247
|
- lib
|
248
248
|
required_ruby_version: !ruby/object:Gem::Requirement
|
249
249
|
requirements:
|
250
|
-
- -
|
250
|
+
- - ">="
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: '0'
|
253
253
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
254
|
requirements:
|
255
|
-
- -
|
255
|
+
- - ">="
|
256
256
|
- !ruby/object:Gem::Version
|
257
257
|
version: '0'
|
258
258
|
requirements: []
|