Class: ConvertSdk::ExperienceManager Private
- Inherits:
-
Object
- Object
- ConvertSdk::ExperienceManager
- Defined in:
- lib/convert_sdk/experience_manager.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Variation-selection support — the thin per-experience / across-experiences entry surface over the DataManager decision flow.
This mirrors the JS +experience-manager.ts+ division of labor EXACTLY: the ExperienceManager owns variation SELECTION (the public-ish +select_variation+ / +select_variations+ seams that Context drives), while the ORDERED decision FLOW — entity -> archived -> environment -> stored-bucketing -> locations -> audiences -> custom segments -> traffic allocation -> variation — lives in DataManager#get_bucketing (JS +data-manager.ts:227-720+). A reordered step is a parity bug; the order is owned in ONE place (DataManager) and exercised, not duplicated here.
== +select_variation+ (one experience by key)
Delegates straight to DataManager#get_bucketing, returning a frozen BucketedVariation on a hit or a Sentinel (RuleError/BucketingError) on a miss — JS +selectVariation+ (+experience-manager.ts:110-116+).
== +select_variations+ (all experiences)
Maps DataManager#get_bucketing over EVERY configured experience and FILTERS OUT every non-decision: +nil+, RuleError, and BucketingError sentinels. This is the JS +selectVariations+ contract (+experience-manager.ts:159-168+): the across-all-experiences call returns ONLY the variations a visitor was actually bucketed into; misses never appear in the list (FR16 return shape).
Instance Method Summary collapse
-
#initialize(data_manager:, log_manager: nil) ⇒ ExperienceManager
constructor
private
A new instance of ExperienceManager.
-
#select_variation(visitor_id, experience_key, attributes = {}) ⇒ BucketedVariation, Sentinel
private
Decide one experience for a visitor by experience key.
-
#select_variations(visitor_id, attributes = {}) ⇒ Array<BucketedVariation>
private
Decide ALL configured experiences for a visitor, returning only the successful bucketed variations (misses filtered — JS parity).
Constructor Details
#initialize(data_manager:, log_manager: nil) ⇒ ExperienceManager
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ExperienceManager.
35 36 37 38 |
# File 'lib/convert_sdk/experience_manager.rb', line 35 def initialize(data_manager:, log_manager: nil) @data_manager = data_manager @log_manager = log_manager end |
Instance Method Details
#select_variation(visitor_id, experience_key, attributes = {}) ⇒ BucketedVariation, Sentinel
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Decide one experience for a visitor by experience key.
49 50 51 |
# File 'lib/convert_sdk/experience_manager.rb', line 49 def select_variation(visitor_id, experience_key, attributes = {}) @data_manager.get_bucketing(visitor_id, experience_key, attributes) end |
#select_variations(visitor_id, attributes = {}) ⇒ Array<BucketedVariation>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Decide ALL configured experiences for a visitor, returning only the successful bucketed variations (misses filtered — JS parity).
60 61 62 63 64 65 66 67 |
# File 'lib/convert_sdk/experience_manager.rb', line 60 def select_variations(visitor_id, attributes = {}) @data_manager.experiences.filter_map do |experience| next unless experience.is_a?(Hash) result = @data_manager.get_bucketing(visitor_id, experience["key"], attributes) result if result.is_a?(BucketedVariation) end end |