Class: ConvertSdk::BucketedVariation

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializevoid

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_allocationObject

Returns the value of attribute bucketing_allocation

Returns:

  • (Object)

    the current value of bucketing_allocation



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def bucketing_allocation
  @bucketing_allocation
end

#changesObject

Returns the value of attribute changes

Returns:

  • (Object)

    the current value of changes



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def changes
  @changes
end

#experience_idObject

Returns the value of attribute experience_id

Returns:

  • (Object)

    the current value of experience_id



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def experience_id
  @experience_id
end

#experience_keyObject

Returns the value of attribute experience_key

Returns:

  • (Object)

    the current value of experience_key



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def experience_key
  @experience_key
end

#experience_nameObject

Returns the value of attribute experience_name

Returns:

  • (Object)

    the current value of experience_name



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def experience_name
  @experience_name
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def id
  @id
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def key
  @key
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def name
  @name
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



19
20
21
# File 'lib/convert_sdk/bucketed_variation.rb', line 19

def status
  @status
end

#traffic_allocationObject

Returns the value of attribute traffic_allocation

Returns:

  • (Object)

    the current value of 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.

Returns:

  • (Boolean)

    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