confeature 0.0.0 → 0.1.0

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.
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ module Confeature
6
+ # Targeting context for flag evaluation.
7
+ #
8
+ # Field names mirror the upstream `configcat` gem's `User` 1:1
9
+ # (Constitution Principle II). The evaluator consumes `identifier`,
10
+ # `email`, `country`, and typed `custom` attributes.
11
+ #
12
+ # `custom` accepts TYPED values, matching the upstream `configcat`
13
+ # gem's `User` (which stores `custom` verbatim — no stringification).
14
+ # A value may be a `String`, `Integer`, `Float`, `Time`/`DateTime`,
15
+ # `true`/`false`, or `Array<String>`. The evaluator converts each
16
+ # non-string value per ConfigCat's documented comparator semantics
17
+ # (number → invariant decimal string, date → Unix epoch seconds,
18
+ # string array → JSON). Keys are coerced to `String`; values pass
19
+ # through verbatim so the evaluator can apply type-specific
20
+ # conversions (string values behave byte-identically to before).
21
+ class User
22
+ attr_reader :identifier, :email, :country, :custom
23
+
24
+ # @param identifier [String] Stable user identifier (required, empty allowed).
25
+ # @param email [String, nil] Optional contact email.
26
+ # @param country [String, nil] Optional ISO country code or country tag.
27
+ # @param custom [Hash{String => Object}, nil] Optional map of typed custom
28
+ # attributes (String / Integer / Float / Time / DateTime / boolean /
29
+ # Array<String>). Values are NOT stringified — they pass through verbatim
30
+ # to the evaluator (matches the upstream `configcat` gem 1:1).
31
+ def initialize(identifier:, email: nil, country: nil, custom: nil)
32
+ @identifier = identifier
33
+ @email = email
34
+ @country = country
35
+ @custom = custom.nil? ? nil : custom.transform_keys(&:to_s).freeze
36
+ freeze
37
+ end
38
+
39
+ def ==(other)
40
+ other.is_a?(User) &&
41
+ identifier == other.identifier &&
42
+ email == other.email &&
43
+ country == other.country &&
44
+ custom == other.custom
45
+ end
46
+ alias eql? ==
47
+
48
+ def hash
49
+ [identifier, email, country, custom].hash
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ module Confeature
6
+ # Public SDK version, surfaced as both `Confeature::VERSION` and the
7
+ # `version` field on the gemspec. The major version tracks the
8
+ # Confeature API contract major version this SDK implements
9
+ # (Constitution Principle VI).
10
+ VERSION = "0.1.0"
11
+ end
data/lib/confeature.rb CHANGED
@@ -1 +1,39 @@
1
- # Placeholder: the Confeature Ruby SDK is not released yet.
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ # Top-level barrel for the Confeature Ruby SDK.
6
+ #
7
+ # The public API surface mirrors the upstream `configcat` gem 1:1
8
+ # (Constitution Principle II): a customer that already uses ConfigCat
9
+ # in Ruby can migrate by changing the require name and the SDK key
10
+ # value.
11
+
12
+ require_relative "confeature/version"
13
+ require_relative "confeature/user"
14
+ require_relative "confeature/log_level"
15
+ require_relative "confeature/logger"
16
+ require_relative "confeature/polling_mode"
17
+ require_relative "confeature/flag_overrides"
18
+ require_relative "confeature/evaluation_details"
19
+ require_relative "confeature/snapshot"
20
+ require_relative "confeature/client"
21
+
22
+ # Re-export internal SDK-key helpers at the top level for unit tests
23
+ # and parity-corpus verification. These live under `Confeature::` and
24
+ # delegate to `Confeature::Internal::SdkKey`.
25
+ require_relative "confeature/internal/sdk_key"
26
+
27
+ module Confeature
28
+ def self.derive_cache_key(sdk_key)
29
+ Internal::SdkKey.derive_cache_key(sdk_key)
30
+ end
31
+
32
+ def self.redact_sdk_key(sdk_key)
33
+ Internal::SdkKey.redact(sdk_key)
34
+ end
35
+
36
+ def self.valid_confeature_key_format?(sdk_key)
37
+ Internal::SdkKey.valid_confeature_key_format?(sdk_key)
38
+ end
39
+ end
metadata CHANGED
@@ -1,15 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confeature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MakerLabs
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies: []
12
- description: The first real release is coming; do not depend on 0.0.0.
11
+ date: 2026-10-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: logger
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ description: |
42
+ Confeature is an open-source feature-flag service that mirrors the ConfigCat
43
+ API surface 1:1 (Constitution Principle II). The `confeature` gem is the
44
+ Ruby SDK: same public class names, same option keywords, same polling
45
+ modes, same flag-override semantics as `configcat`. Migrate by renaming the
46
+ gem and swapping the SDK key.
47
+ email:
13
48
  executables: []
14
49
  extensions: []
15
50
  extra_rdoc_files: []
@@ -17,12 +52,39 @@ files:
17
52
  - LICENSE
18
53
  - README.md
19
54
  - lib/confeature.rb
55
+ - lib/confeature/client.rb
56
+ - lib/confeature/evaluation_details.rb
57
+ - lib/confeature/flag_overrides.rb
58
+ - lib/confeature/hooks.rb
59
+ - lib/confeature/internal/cache.rb
60
+ - lib/confeature/internal/comparators.rb
61
+ - lib/confeature/internal/config_fetcher.rb
62
+ - lib/confeature/internal/eval_log.rb
63
+ - lib/confeature/internal/eval_logger.rb
64
+ - lib/confeature/internal/evaluator.rb
65
+ - lib/confeature/internal/hashing.rb
66
+ - lib/confeature/internal/override_eval.rb
67
+ - lib/confeature/internal/poll_service.rb
68
+ - lib/confeature/internal/prerequisites.rb
69
+ - lib/confeature/internal/sdk_key.rb
70
+ - lib/confeature/internal/segments.rb
71
+ - lib/confeature/internal/semver.rb
72
+ - lib/confeature/log_level.rb
73
+ - lib/confeature/logger.rb
74
+ - lib/confeature/polling_mode.rb
75
+ - lib/confeature/snapshot.rb
76
+ - lib/confeature/user.rb
77
+ - lib/confeature/version.rb
20
78
  homepage: https://confeature.io
21
79
  licenses:
22
80
  - MIT
23
81
  metadata:
82
+ homepage_uri: https://confeature.io
24
83
  source_code_uri: https://github.com/confeature/sdks
84
+ bug_tracker_uri: https://github.com/confeature/sdks/issues
85
+ documentation_uri: https://docs.confeature.io/sdks/ruby/
25
86
  rubygems_mfa_required: 'true'
87
+ post_install_message:
26
88
  rdoc_options: []
27
89
  require_paths:
28
90
  - lib
@@ -30,14 +92,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
30
92
  requirements:
31
93
  - - ">="
32
94
  - !ruby/object:Gem::Version
33
- version: '2.7'
95
+ version: '3.0'
34
96
  required_rubygems_version: !ruby/object:Gem::Requirement
35
97
  requirements:
36
98
  - - ">="
37
99
  - !ruby/object:Gem::Version
38
100
  version: '0'
39
101
  requirements: []
40
- rubygems_version: 4.0.11
102
+ rubygems_version: 3.5.22
103
+ signing_key:
41
104
  specification_version: 4
42
- summary: Name reserved for the Confeature Ruby SDK (ConfigCat-compatible).
105
+ summary: Ruby SDK for Confeature — drop-in compatible with ConfigCat's configcat gem.
43
106
  test_files: []