Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion launchdarkly-openfeature-server-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_runtime_dependency "launchdarkly-server-sdk", "~> 8.4"
spec.add_runtime_dependency "launchdarkly-server-sdk", "~> 8.15"
spec.add_runtime_dependency "openfeature-sdk", "~> 0.6.0"

# For more information and examples about making a new gem, check out our
Expand Down
5 changes: 4 additions & 1 deletion lib/ldclient-openfeature/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ class Provider
NUMERIC_TYPES = %i[integer float number].freeze
private_constant :NUMERIC_TYPES

WRAPPER_NAME = "open-feature-ruby-server"
private_constant :WRAPPER_NAME

#
# @param sdk_key [String]
# @param config [LaunchDarkly::Config]
# @param wait_for_seconds [Float]
#
def initialize(sdk_key, config = LaunchDarkly::Config.default, wait_for_seconds = 5)
@client = LaunchDarkly::LDClient.new(sdk_key, config, wait_for_seconds)
@client = LaunchDarkly::LDClient.new(sdk_key, config.with_wrapper_information(WRAPPER_NAME, VERSION), wait_for_seconds)

@context_converter = Impl::EvaluationContextConverter.new(config.logger)
@details_converter = Impl::ResolutionDetailsConverter.new
Expand Down
13 changes: 13 additions & 0 deletions spec/provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@
expect(provider.client).to be_a LaunchDarkly::LDClient
end

it "reports itself as the wrapper to LaunchDarkly" do
allow(LaunchDarkly::LDClient).to receive(:new).and_return(instance_double(LaunchDarkly::LDClient))

described_class.new("example-key", config)

expect(LaunchDarkly::LDClient).to have_received(:new).with(
"example-key",
having_attributes(wrapper_name: "open-feature-ruby-server", wrapper_version: LaunchDarkly::OpenFeature::VERSION),
5
)
expect(config.wrapper_name).to be_nil
end

it "not providing context returns error" do
resolution_details = provider.fetch_boolean_value(flag_key: "flag-key", default_value: true)

Expand Down
Loading