Module: ConvertSdk
- Defined in:
- lib/convert_sdk.rb,
lib/convert_sdk/client.rb,
lib/convert_sdk/config.rb,
lib/convert_sdk/context.rb,
lib/convert_sdk/version.rb,
lib/convert_sdk/redactor.rb,
lib/convert_sdk/sentinel.rb,
lib/convert_sdk/fork_guard.rb,
lib/convert_sdk/api_manager.rb,
lib/convert_sdk/comparisons.rb,
lib/convert_sdk/http_client.rb,
lib/convert_sdk/log_manager.rb,
lib/convert_sdk/data_manager.rb,
lib/convert_sdk/murmur_hash3.rb,
lib/convert_sdk/rule_manager.rb,
lib/convert_sdk/event_manager.rb,
lib/convert_sdk/visitors_queue.rb,
lib/convert_sdk/enums/log_level.rb,
lib/convert_sdk/feature_manager.rb,
lib/convert_sdk/background_timer.rb,
lib/convert_sdk/bucketed_feature.rb,
lib/convert_sdk/config_validator.rb,
lib/convert_sdk/enums/rule_error.rb,
lib/convert_sdk/segments_manager.rb,
lib/convert_sdk/bucketing_manager.rb,
lib/convert_sdk/bucketed_variation.rb,
lib/convert_sdk/data_store_manager.rb,
lib/convert_sdk/experience_manager.rb,
lib/convert_sdk/stores/redis_store.rb,
lib/convert_sdk/enums/goal_data_key.rb,
lib/convert_sdk/enums/system_events.rb,
lib/convert_sdk/stores/memory_store.rb,
lib/convert_sdk/enums/feature_status.rb,
lib/convert_sdk/enums/bucketing_error.rb
Overview
The Convert Experiences full-stack SDK for Ruby.
ConvertSdk.create is THE public entry point (frozen API name): it builds the validated Config, wires the managers, and returns a ready-to-use Client.
Defined Under Namespace
Modules: BucketingError, Comparisons, FeatureStatus, ForkGuard, GoalDataKey, LogLevel, MurmurHash3, RuleError, Stores, SystemEvents Classes: ApiManager, BackgroundTimer, BucketedFeature, BucketedVariation, BucketingManager, Client, Config, ConfigValidator, Context, DataManager, DataStoreManager, Error, EventManager, ExperienceManager, FeatureManager, HttpClient, LogManager, Redactor, RuleManager, SegmentsManager, Sentinel, VisitorsQueue
Constant Summary collapse
- DEFAULT_CONFIG_TTL =
The default config-cache TTL in seconds, used by the timer-off (Lambda/CLI) decision-time staleness check when
data_refresh_intervalisnil(timer-off ≠ TTL-off). 300s converges on the same cadence the background timer uses, on demand. A Ruby-SDK design constant (PHP on-demand TTL semantics) — the JS SDK has no timer-off TTL concept. See Story 2.7. 300- VERSION =
The gem version string (semantic version).
This is a DEV PLACEHOLDER. The real version is written here at release time by the semantic-release
@semantic-release/execprepareCmd (release.config.mjs), as an UNCOMMITTED working-tree edit — the gem builds carrying the computed version, butmainnever receives a version-bump commit. The next release derives its version from this run's git tag, not from this file (FR66). Mirrors the Android SDK's0.0.0placeholder in gradle/libs.versions.toml. "0.0.0"
Class Method Summary collapse
-
.at_exit_registration_enabled=(value) ⇒ Boolean
Set the ConvertSdk.at_exit_registration_enabled? flag (test harness only).
-
.at_exit_registration_enabled? ⇒ Boolean
Whether Client registers its PID-guarded
at_exitflush handler at construction (Story 4.4 AC#5). -
.create(sdk_key: nil, data: nil, store: nil, clock: nil, sink: nil, **options) ⇒ Client
Build an SDK client from an SDK key (live config fetch) or a pre-fetched
data:object (direct data mode).
Class Method Details
.at_exit_registration_enabled=(value) ⇒ Boolean
Set the at_exit_registration_enabled? flag (test harness only).
77 78 79 |
# File 'lib/convert_sdk.rb', line 77 def self.at_exit_registration_enabled=(value) @at_exit_registration_enabled = value end |
.at_exit_registration_enabled? ⇒ Boolean
Whether Client registers its PID-guarded at_exit flush handler at
construction (Story 4.4 AC#5). Always true in production. The TEST HARNESS
alone flips this off (a spec/support hook) so unit specs that build clients
do NOT register live at_exit handlers — which would fire flush during
RSpec suite teardown. The handler BODY is unit-tested directly via
Client#run_at_exit_flush; the live-registration path is proven end-to-end
in a SUBPROCESS in spec/integration/fork_safety_spec.rb.
69 70 71 72 |
# File 'lib/convert_sdk.rb', line 69 def self.at_exit_registration_enabled? @at_exit_registration_enabled = true unless defined?(@at_exit_registration_enabled) @at_exit_registration_enabled end |
.create(sdk_key: nil, data: nil, store: nil, clock: nil, sink: nil, **options) ⇒ Client
Build an SDK client from an SDK key (live config fetch) or a pre-fetched
data: object (direct data mode). THE public entry point.
Wiring order: a LogManager is built first, then Config (which registers
any sdk_key / sdk_key_secret with the manager's Redactor before any log
line can carry them and raises ArgumentError on misconfiguration — the
SDK's only raising surface), then the HttpClient, DataStoreManager,
EventManager, and DataManager ports, then the Client (which fetches /
installs config and fires ready). No background threads are started here
(NFR4 — lazy start; the refresh / flush timers are wired by their own
stories).
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/convert_sdk.rb', line 116 def self.create(sdk_key: nil, data: nil, store: nil, clock: nil, sink: nil, **) = .merge(sdk_key: sdk_key, data: data) log_manager = LogManager.new( level: .fetch(:log_level, Config::DEFAULTS[:log_level]), sink: sink ) # Wire the ForkGuard re-arm logger (Story 2.7) so fork-detection debug lines # flow through the redacting LogManager. nil-safe before wiring. ForkGuard.logger = log_manager config = Config.new(log_manager: log_manager, **) Client.new(config: config, log_manager: log_manager, **build_managers(config, log_manager, store, clock)) end |