launchdarkly-server-sdk 8.0.0 → 8.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/ldclient-rb/context.rb +65 -5
- data/lib/ldclient-rb/impl/context_filter.rb +1 -1
- data/lib/ldclient-rb/impl/integrations/redis_impl.rb +1 -1
- data/lib/ldclient-rb/ldclient.rb +1 -0
- data/lib/ldclient-rb/reference.rb +11 -0
- data/lib/ldclient-rb/requestor.rb +2 -0
- data/lib/ldclient-rb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98f2eba56f5e878e25f09c11f1899a9e08528951f168c0c99f8a366dc2774e42
|
4
|
+
data.tar.gz: fab62196eca4450f87753d937fa229f67eece5811b6f3f9c2080d7c974939017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1702df3413b7d6652d040a4e03ae46b303af04172db296e5351e0a7e656c8fd93e8e9f64d8582f8a03bc2d79d3d77c3dbead0cac71d196a6f0cdd686af62a476
|
7
|
+
data.tar.gz: 27d299283793f15aab495d01e8ece7c92dd026a73a44ffbf29925272c82a6810ea264eb36691d383238cda4cfc88664a0f9b4fd077547d2661bec9f1b3070358
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ LaunchDarkly Server-side SDK for Ruby
|
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/launchdarkly-server-sdk.svg)](http://badge.fury.io/rb/launchdarkly-server-sdk)
|
5
5
|
|
6
|
-
[![
|
6
|
+
[![Run CI](https://github.com/launchdarkly/ruby-server-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/launchdarkly/ruby-server-sdk/actions/workflows/ci.yml)
|
7
7
|
[![RubyDoc](https://img.shields.io/static/v1?label=docs+-+all+versions&message=reference&color=00add8)](https://www.rubydoc.info/gems/launchdarkly-server-sdk)
|
8
8
|
[![GitHub Pages](https://img.shields.io/static/v1?label=docs+-+latest&message=reference&color=00add8)](https://launchdarkly.github.io/ruby-server-sdk)
|
9
9
|
|
@@ -39,7 +39,12 @@ Contributing
|
|
39
39
|
------------
|
40
40
|
|
41
41
|
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK.
|
42
|
-
|
42
|
+
|
43
|
+
Verifying SDK build provenance with the SLSA framework
|
44
|
+
------------
|
45
|
+
|
46
|
+
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
|
47
|
+
|
43
48
|
About LaunchDarkly
|
44
49
|
-----------
|
45
50
|
|
data/lib/ldclient-rb/context.rb
CHANGED
@@ -47,9 +47,6 @@ module LaunchDarkly
|
|
47
47
|
# @return [String, nil] Returns the error associated with this LDContext if invalid
|
48
48
|
attr_reader :error
|
49
49
|
|
50
|
-
# @return [Array<Reference>] Returns the private attributes associated with this LDContext
|
51
|
-
attr_reader :private_attributes
|
52
|
-
|
53
50
|
#
|
54
51
|
# @private
|
55
52
|
# @param key [String, nil]
|
@@ -69,10 +66,10 @@ module LaunchDarkly
|
|
69
66
|
@name = name
|
70
67
|
@anonymous = anonymous || false
|
71
68
|
@attributes = attributes
|
72
|
-
@private_attributes =
|
69
|
+
@private_attributes = Set.new
|
73
70
|
(private_attributes || []).each do |attribute|
|
74
71
|
reference = Reference.create(attribute)
|
75
|
-
@private_attributes
|
72
|
+
@private_attributes.add(reference) if reference.error.nil?
|
76
73
|
end
|
77
74
|
@error = error
|
78
75
|
@contexts = contexts
|
@@ -80,6 +77,16 @@ module LaunchDarkly
|
|
80
77
|
end
|
81
78
|
private_class_method :new
|
82
79
|
|
80
|
+
protected attr_reader :name, :anonymous, :attributes
|
81
|
+
|
82
|
+
#
|
83
|
+
# @return [Array<Reference>] Returns the private attributes associated with this LDContext
|
84
|
+
#
|
85
|
+
def private_attributes
|
86
|
+
# TODO(sc-227265): Return a set instead of an array.
|
87
|
+
@private_attributes.to_a
|
88
|
+
end
|
89
|
+
|
83
90
|
#
|
84
91
|
# @return [Boolean] Is this LDContext a multi-kind context?
|
85
92
|
#
|
@@ -274,6 +281,59 @@ module LaunchDarkly
|
|
274
281
|
nil
|
275
282
|
end
|
276
283
|
|
284
|
+
#
|
285
|
+
# An LDContext can be compared to other LDContexts or to a hash object. If
|
286
|
+
# a hash is provided, it is first converted to an LDContext using the
|
287
|
+
# `LDContext.create` method.
|
288
|
+
#
|
289
|
+
# @param other [LDContext, Hash]
|
290
|
+
# @return [Boolean]
|
291
|
+
#
|
292
|
+
def ==(other)
|
293
|
+
other = LDContext.create(other) if other.is_a? Hash
|
294
|
+
return false unless other.is_a? LDContext
|
295
|
+
|
296
|
+
return false unless self.kind == other.kind
|
297
|
+
return false unless self.valid? == other.valid?
|
298
|
+
return false unless self.error == other.error
|
299
|
+
|
300
|
+
return false unless self.individual_context_count == other.individual_context_count
|
301
|
+
|
302
|
+
if self.multi_kind?
|
303
|
+
self.kinds.each do |kind|
|
304
|
+
return false unless self.individual_context(kind) == other.individual_context(kind)
|
305
|
+
end
|
306
|
+
|
307
|
+
return true
|
308
|
+
end
|
309
|
+
|
310
|
+
return false unless self.key == other.key
|
311
|
+
return false unless self.name == other.name
|
312
|
+
return false unless self.anonymous == other.anonymous
|
313
|
+
return false unless self.attributes == other.attributes
|
314
|
+
|
315
|
+
# TODO(sc-227265): Calling .to_set is unnecessary once private_attributes are sets.
|
316
|
+
return false unless self.private_attributes.to_set == other.private_attributes.to_set
|
317
|
+
|
318
|
+
true
|
319
|
+
end
|
320
|
+
alias eql? ==
|
321
|
+
|
322
|
+
#
|
323
|
+
# For a single-kind context, the provided key will return the attribute value specified. This is the same as calling
|
324
|
+
# `LDCotnext.get_value`.
|
325
|
+
#
|
326
|
+
# For multi-kind contexts, the key will be interpreted as a context kind. If the multi-kind context has an
|
327
|
+
# individual context of that kind, it will be returned. Otherwise, this method will return nil. This behaves the
|
328
|
+
# same as calling `LDContext.individual_context`.
|
329
|
+
#
|
330
|
+
# @param key [Symbol, String]
|
331
|
+
#
|
332
|
+
def [](key)
|
333
|
+
return nil unless key.is_a? Symbol or key.is_a? String
|
334
|
+
multi_kind? ? individual_context(key.to_s) : get_value(key)
|
335
|
+
end
|
336
|
+
|
277
337
|
#
|
278
338
|
# Retrieve the value of any top level, addressable attribute.
|
279
339
|
#
|
@@ -112,7 +112,7 @@ module LaunchDarkly
|
|
112
112
|
@pool = create_redis_pool(opts)
|
113
113
|
|
114
114
|
# shutdown pool on close unless the client passed a custom pool and specified not to shutdown
|
115
|
-
@pool_shutdown_on_close =
|
115
|
+
@pool_shutdown_on_close = !opts[:pool] || opts.fetch(:pool_shutdown_on_close, true)
|
116
116
|
|
117
117
|
@prefix = opts[:prefix] || LaunchDarkly::Integrations::Redis::default_prefix
|
118
118
|
@logger = opts[:logger] || Config.default_logger
|
data/lib/ldclient-rb/ldclient.rb
CHANGED
@@ -109,6 +109,8 @@ module LaunchDarkly
|
|
109
109
|
end
|
110
110
|
private_class_method :new
|
111
111
|
|
112
|
+
protected attr_reader :components
|
113
|
+
|
112
114
|
#
|
113
115
|
# Creates a Reference from a string. For the supported syntax and examples,
|
114
116
|
# see comments on the Reference type.
|
@@ -227,6 +229,15 @@ module LaunchDarkly
|
|
227
229
|
@components[index]
|
228
230
|
end
|
229
231
|
|
232
|
+
def ==(other)
|
233
|
+
self.error == other.error && self.components == other.components
|
234
|
+
end
|
235
|
+
alias eql? ==
|
236
|
+
|
237
|
+
def hash
|
238
|
+
([error] + components).hash
|
239
|
+
end
|
240
|
+
|
230
241
|
#
|
231
242
|
# Performs unescaping of attribute reference path components:
|
232
243
|
#
|
data/lib/ldclient-rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchdarkly-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -361,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
361
361
|
- !ruby/object:Gem::Version
|
362
362
|
version: '0'
|
363
363
|
requirements: []
|
364
|
-
rubygems_version: 3.
|
364
|
+
rubygems_version: 3.5.3
|
365
365
|
signing_key:
|
366
366
|
specification_version: 4
|
367
367
|
summary: LaunchDarkly SDK for Ruby
|