openfeature-go-feature-flag-provider 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 116cdf1f3d6b2f17ff01c42064fec29636c9921dfbd717d5e8d6293f2293f758
4
- data.tar.gz: c5ea59e6c8ea088c343e2381b1937356e59073af4e83487896e4e3505f644faa
3
+ metadata.gz: 06fbdcc3c614c61afbea2daf01673e32ec2e6a3ce6fb61cca3b38974fb8610e3
4
+ data.tar.gz: 8334fe12234af1b4d074f132a0b16cd96b418d33c94f35b3bf6c369a5864f9a3
5
5
  SHA512:
6
- metadata.gz: df7549c061a20dd165473ae02eb7cb41dc1e8f5224b7c62ab45bb9dd6af0f38eb55b84959f4710d80b69a96b348a3be6f6ab98feb1799d2565ca3b649e648bc8
7
- data.tar.gz: 6387510e2e62c7542a40ce60eacb2d47f7a789836b2524ac48eb91ea37e01fa29674053bfb6b9e2402e9e980ace3385436799f174023035c0b63dc9875e19aaf
6
+ metadata.gz: af3f930d2479b0d288034825d4bb69699b9c340136b69dd2186b79eb6a4c710a660e7b4ae2cf1a1b1f284a17f7ec1ae97c92f11c7690110342e33671a7136f57
7
+ data.tar.gz: 473b42bf836ac156e4f8f7204ad25c20c391dcb07a6e5c46b82d4c420f80a2962872831da456528ec73a7620d12c011392cce0efef331721b8ccbdc56815be43
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.4](https://github.com/open-feature/ruby-sdk-contrib/compare/openfeature-go-feature-flag-provider/v0.1.3...openfeature-go-feature-flag-provider/v0.1.4) (2025-07-30)
4
+
5
+
6
+ ### ✨ New Features
7
+
8
+ * connection persistance ([#59](https://github.com/open-feature/ruby-sdk-contrib/issues/59)) ([3a01a5e](https://github.com/open-feature/ruby-sdk-contrib/commit/3a01a5e4cc597aa0bc223e71f3e165f63c66f296))
9
+
10
+ ## [0.1.3](https://github.com/open-feature/ruby-sdk-contrib/compare/openfeature-go-feature-flag-provider/v0.1.2...openfeature-go-feature-flag-provider/v0.1.3) (2025-01-25)
11
+
12
+
13
+ ### ✨ New Features
14
+
15
+ * **go-feature-flag:** Support exporter metadata ([#45](https://github.com/open-feature/ruby-sdk-contrib/issues/45)) ([04754fd](https://github.com/open-feature/ruby-sdk-contrib/commit/04754fd24e33ce993a9da3ddcaf84c34f9cb2342))
16
+
3
17
  ## [0.1.2](https://github.com/open-feature/ruby-sdk-contrib/compare/openfeature-go-feature-flag-provider/v0.1.1...openfeature-go-feature-flag-provider/v0.1.2) (2024-12-02)
4
18
 
5
19
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openfeature-go-feature-flag-provider (0.1.2)
5
- faraday (~> 2.10)
4
+ openfeature-go-feature-flag-provider (0.1.4)
5
+ faraday-net_http_persistent (~> 2.3)
6
6
  openfeature-sdk (~> 0.3.1)
7
7
 
8
8
  GEM
@@ -12,24 +12,30 @@ GEM
12
12
  public_suffix (>= 2.0.2, < 7.0)
13
13
  ast (2.4.2)
14
14
  bigdecimal (3.1.8)
15
+ connection_pool (2.5.3)
15
16
  crack (1.0.0)
16
17
  bigdecimal
17
18
  rexml
18
19
  diff-lcs (1.5.1)
19
20
  docile (1.4.1)
20
- faraday (2.12.1)
21
+ faraday (2.13.4)
21
22
  faraday-net_http (>= 2.0, < 3.5)
22
23
  json
23
24
  logger
24
- faraday-net_http (3.4.0)
25
+ faraday-net_http (3.4.1)
25
26
  net-http (>= 0.5.0)
27
+ faraday-net_http_persistent (2.3.1)
28
+ faraday (~> 2.5)
29
+ net-http-persistent (>= 4.0.4, < 5)
26
30
  hashdiff (1.1.1)
27
- json (2.7.2)
31
+ json (2.13.2)
28
32
  language_server-protocol (3.17.0.3)
29
33
  lint_roller (1.1.0)
30
- logger (1.6.1)
31
- net-http (0.5.0)
34
+ logger (1.7.0)
35
+ net-http (0.6.0)
32
36
  uri
37
+ net-http-persistent (4.0.6)
38
+ connection_pool (~> 2.2, >= 2.2.4)
33
39
  openfeature-sdk (0.3.1)
34
40
  parallel (1.24.0)
35
41
  parser (3.3.0.5)
@@ -92,7 +98,7 @@ GEM
92
98
  rubocop-performance (~> 1.20.2)
93
99
  strscan (3.1.0)
94
100
  unicode-display_width (2.5.0)
95
- uri (1.0.2)
101
+ uri (1.0.3)
96
102
  webmock (3.23.1)
97
103
  addressable (>= 2.8.0)
98
104
  crack (>= 0.3.2)
@@ -10,7 +10,7 @@ module OpenFeature
10
10
  def initialize(options: Options.new)
11
11
  @metadata = SDK::Provider::ProviderMetadata.new(name: PROVIDER_NAME)
12
12
  @options = options
13
- @goff_api = GoFeatureFlagApi.new(options: options)
13
+ @goff_api = GoFeatureFlagApi.new(endpoint: options.endpoint, custom_headers: options.custom_headers)
14
14
  end
15
15
 
16
16
  def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil)
@@ -35,6 +35,10 @@ module OpenFeature
35
35
  evaluation_context = OpenFeature::SDK::EvaluationContext.new if evaluation_context.nil?
36
36
  validate_parameters(flag_key, evaluation_context)
37
37
 
38
+ # enrich the evaluation context with the exporter_metadata
39
+ @options.exporter_metadata.merge!("openfeature" => true, "provider" => "ruby")
40
+ evaluation_context.fields["gofeatureflag"] = {"exporterMetadata" => @options.exporter_metadata}
41
+
38
42
  # do a http call to the go feature flag server
39
43
  parsed_response = @goff_api.evaluate_ofrep_api(flag_key: flag_key, evaluation_context: evaluation_context)
40
44
  parsed_response = OfrepApiResponse unless parsed_response.is_a?(OfrepApiResponse)
@@ -3,7 +3,7 @@
3
3
  require "open_feature/sdk"
4
4
  require "net/http"
5
5
  require "json"
6
- require "faraday"
6
+ require "faraday/net_http_persistent"
7
7
  require_relative "error/errors"
8
8
  require_relative "model/ofrep_api_response"
9
9
 
@@ -11,13 +11,12 @@ module OpenFeature
11
11
  module GoFeatureFlag
12
12
  # This class is the entry point for the GoFeatureFlagProvider
13
13
  class GoFeatureFlagApi
14
- attr_reader :options
15
- def initialize(options: {})
16
- @options = options
17
- @faraday_connection = Faraday.new(
18
- url: @options.endpoint,
19
- headers: {"Content-Type" => "application/json"}.merge(@options.custom_headers || {})
20
- )
14
+ def initialize(endpoint: nil, custom_headers: nil)
15
+ @faraday_connection = Faraday.new(url: endpoint, headers: headers(custom_headers)) do |f|
16
+ f.adapter :net_http_persistent do |http|
17
+ http.idle_timeout = 30
18
+ end
19
+ end
21
20
  end
22
21
 
23
22
  def evaluate_ofrep_api(flag_key:, evaluation_context:)
@@ -57,6 +56,10 @@ module OpenFeature
57
56
 
58
57
  private
59
58
 
59
+ def headers(custom_headers)
60
+ {"Content-Type" => "application/json"}.merge(custom_headers || {})
61
+ end
62
+
60
63
  def parse_error_response(response)
61
64
  required_keys = %w[key error_code]
62
65
  parsed = JSON.parse(response.body)
@@ -6,12 +6,13 @@ module OpenFeature
6
6
  module GoFeatureFlag
7
7
  # This class is the configuration class for the GoFeatureFlagProvider
8
8
  class Options
9
- attr_accessor :endpoint, :custom_headers
9
+ attr_accessor :endpoint, :custom_headers, :exporter_metadata
10
10
 
11
- def initialize(endpoint: nil, headers: {})
11
+ def initialize(endpoint: nil, headers: {}, exporter_metadata: {})
12
12
  validate_endpoint(endpoint: endpoint)
13
13
  @endpoint = endpoint
14
14
  @custom_headers = headers
15
+ @exporter_metadata = exporter_metadata
15
16
  end
16
17
 
17
18
  private
@@ -1,5 +1,5 @@
1
1
  module OpenFeature
2
2
  module GoFeatureFlag
3
- GO_FEATURE_FLAG_PROVIDER_VERSION = "0.1.2"
3
+ GO_FEATURE_FLAG_PROVIDER_VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_runtime_dependency "openfeature-sdk", "~> 0.3.1"
33
- spec.add_runtime_dependency "faraday", "~> 2.10"
33
+ spec.add_runtime_dependency "faraday-net_http_persistent", "~> 2.3"
34
34
 
35
35
  spec.add_development_dependency "rake", "~> 13.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.12.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openfeature-go-feature-flag-provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Poignant
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-02 00:00:00.000000000 Z
11
+ date: 2025-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: openfeature-sdk
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.3.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday
28
+ name: faraday-net_http_persistent
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.10'
33
+ version: '2.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.10'
40
+ version: '2.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +152,7 @@ metadata:
152
152
  changelog_uri: https://github.com/open-feature/ruby-sdk-contrib/blob/main/providers/openfeature-go-feature-flag-provider/CHANGELOG.md
153
153
  bug_tracker_uri: https://github.com/thomaspoignant/go-feature-flag/issues/new/choose
154
154
  documentation_uri: https://gofeatureflag.org/docs
155
- post_install_message:
155
+ post_install_message:
156
156
  rdoc_options: []
157
157
  require_paths:
158
158
  - lib
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubygems_version: 3.5.22
171
- signing_key:
171
+ signing_key:
172
172
  specification_version: 4
173
173
  summary: The GO Feature Flag provider for the OpenFeature Ruby SDK
174
174
  test_files: []