Class: ConvertSdk::BucketedVariation
- Inherits:
-
Struct
- Object
- Struct
- ConvertSdk::BucketedVariation
- Defined in:
- lib/convert_sdk/bucketed_variation.rb
Overview
A successfully bucketed variation — a frozen value object returned when a visitor IS decided into a variation (the success counterpart to a Sentinel business miss).
Implemented as a frozen Struct subclass (NOT Data.define, which requires
Ruby 3.2; this gem's floor is 3.1). Members are snake_case, aligned to the JS
BucketedVariation shape (+ExperienceVariationConfig+ plus the experience
fields), verified against javascript-sdk/packages/types/src/BucketedVariation.ts
and the vendored spec/fixtures/test-config.json variation entity.
v = ConvertSdk::BucketedVariation.new(key: "variation-a", id: "200381")
case v.key
when nil then show_default # a sentinel miss
else render(v.key) # a real decision — error? is false
end
Instance Attribute Summary collapse
-
#bucketing_allocation ⇒ Object
Returns the value of attribute bucketing_allocation.
-
#changes ⇒ Object
Returns the value of attribute changes.
-
#experience_id ⇒ Object
Returns the value of attribute experience_id.
-
#experience_key ⇒ Object
Returns the value of attribute experience_key.
-
#experience_name ⇒ Object
Returns the value of attribute experience_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#key ⇒ Object
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#traffic_allocation ⇒ Object
Returns the value of attribute traffic_allocation.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Always false — a real decision is never a business miss.
-
#initialize ⇒ void
constructor
Builds the struct then freezes it (immutable value object).
Constructor Details
#initialize ⇒ void
Returns builds the struct then freezes it (immutable value object).
33 34 35 36 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 33 def initialize(**) super freeze end |
Instance Attribute Details
#bucketing_allocation ⇒ Object
Returns the value of attribute bucketing_allocation
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def bucketing_allocation @bucketing_allocation end |
#changes ⇒ Object
Returns the value of attribute changes
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def changes @changes end |
#experience_id ⇒ Object
Returns the value of attribute experience_id
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def experience_id @experience_id end |
#experience_key ⇒ Object
Returns the value of attribute experience_key
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def experience_key @experience_key end |
#experience_name ⇒ Object
Returns the value of attribute experience_name
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def experience_name @experience_name end |
#id ⇒ Object
Returns the value of attribute id
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def id @id end |
#key ⇒ Object
Returns the value of attribute key
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def key @key end |
#name ⇒ Object
Returns the value of attribute name
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def name @name end |
#status ⇒ Object
Returns the value of attribute status
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def status @status end |
#traffic_allocation ⇒ Object
Returns the value of attribute traffic_allocation
19 20 21 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 19 def traffic_allocation @traffic_allocation end |
Instance Method Details
#error? ⇒ Boolean
Returns always false — a real decision is never a business miss.
39 40 41 |
# File 'lib/convert_sdk/bucketed_variation.rb', line 39 def error? false end |