Class: Courier::Models::JourneyExperimentVariant

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/journey_experiment_variant.rb,
sig/courier/models/journey_experiment_variant.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, template_id:, weight:, name: nil) ⇒ Object

A single weighted variant of an experiment. Variant ids must be unique within the experiment and the sum of all variant weights must be greater than 0. Weights are relative (no sum-to-100 requirement) — routing normalizes them proportionally.

Parameters:

  • id (String)
  • template_id (String)

    The notification template sent for this variant.

  • weight (Float)

    Relative routing weight. Must be non-negative.

  • name (String) (defaults to: nil)

    Optional display name for the variant.



# File 'lib/courier/models/journey_experiment_variant.rb', line 29

Instance Attribute Details

#idString

Parameters:

  • value (String)

Returns:

  • (String)


9
# File 'lib/courier/models/journey_experiment_variant.rb', line 9

required :id, String

#nameString?

Optional display name for the variant.

Parameters:

  • (String)

Returns:

  • (String, nil)


27
# File 'lib/courier/models/journey_experiment_variant.rb', line 27

optional :name, String

#template_idString

The notification template sent for this variant.

Parameters:

  • value (String)

Returns:

  • (String)


15
# File 'lib/courier/models/journey_experiment_variant.rb', line 15

required :template_id, String, api_name: :templateId

#weightFloat

Relative routing weight. Must be non-negative.

Parameters:

  • value (Float)

Returns:

  • (Float)


21
# File 'lib/courier/models/journey_experiment_variant.rb', line 21

required :weight, Float

Instance Method Details

#to_hash{

Returns:

  • ({)


24
# File 'sig/courier/models/journey_experiment_variant.rbs', line 24

def to_hash: -> {