From 46845a27402a58c7cbd02a35e9a2951c38db60a1 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Fri, 26 Jul 2024 11:25:08 -0400 Subject: [PATCH] chore: Expose LDClient ahead of initial release Exposing the backing LDClient is useful for customers who want to use OpenFeature where possible, but also want access to LaunchDarkly specific functionality (e.g. migrations). --- lib/ldclient-openfeature/provider.rb | 5 +++++ spec/provider_spec.rb | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/ldclient-openfeature/provider.rb b/lib/ldclient-openfeature/provider.rb index 43c4507..c924f92 100644 --- a/lib/ldclient-openfeature/provider.rb +++ b/lib/ldclient-openfeature/provider.rb @@ -8,6 +8,11 @@ module OpenFeature class Provider attr_reader :metadata + # + # @return client [LaunchDarkly::LDClient] + # + attr_reader :client + NUMERIC_TYPES = %i[integer float number].freeze private_constant :NUMERIC_TYPES diff --git a/spec/provider_spec.rb b/spec/provider_spec.rb index b41a283..3cf92b6 100644 --- a/spec/provider_spec.rb +++ b/spec/provider_spec.rb @@ -14,6 +14,10 @@ expect(provider.metadata.name).to eq("launchdarkly-openfeature-server") end + it "exposes the underlying LaunchDarkly client" do + expect(provider.client).to be_a LaunchDarkly::LDClient + end + it "not providing context returns error" do resolution_details = provider.fetch_boolean_value(flag_key: "flag-key", default_value: true)