Class: Orb::Models::Discount::TieredPercentage

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

Defined Under Namespace

Classes: Filter, Tier

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(lower_bound:, percentage:, upper_bound: nil) ⇒ Object

Some parameter documentations has been truncated, see Tier for more details.

One band of a tiered percentage discount. Bounds are denominated in the discount's currency. lower_bound is the exclusive start of the band and upper_bound is the inclusive end; upper_bound is null only for the open-ended final tier.

Parameters:

  • lower_bound (Float)

    Exclusive lower bound of cumulative spend for this tier.

  • percentage (Float)

    The percentage (between 0 and 1) discounted from spend that falls within this ti

  • upper_bound (Float, nil) (defaults to: nil)

    Inclusive upper bound of cumulative spend for this tier; null for the final open



# File 'lib/orb/models/discount.rb', line 89

Instance Attribute Details

#applies_to_price_idsArray<String>?

List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a subset of prices.

Parameters:

  • value (::Array[String], nil)

Returns:

  • (Array<String>, nil)


39
# File 'lib/orb/models/discount.rb', line 39

optional :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String], nil?: true

#discount_typeSymbol, :tiered_percentage

Parameters:

  • value (:tiered_percentage)

Returns:

  • (Symbol, :tiered_percentage)


24
# File 'lib/orb/models/discount.rb', line 24

required :discount_type, const: :tiered_percentage

#filtersArray<Orb::Models::Discount::TieredPercentage::Filter>?

The filters that determine which prices to apply this discount to.

Parameters:

  • value (::Array[Orb::Discount::TieredPercentage::Filter], nil)

Returns:



45
46
47
# File 'lib/orb/models/discount.rb', line 45

optional :filters,
-> { Orb::Internal::Type::ArrayOf[Orb::Discount::TieredPercentage::Filter] },
nil?: true

#reasonString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


52
# File 'lib/orb/models/discount.rb', line 52

optional :reason, String, nil?: true

#tiersArray<Orb::Models::Discount::TieredPercentage::Tier>

Only available if discount_type is tiered_percentage. The ordered, contiguous bands of cumulative eligible spend, each discounted at its own percentage (progressive fill-a-tier).

Parameters:

  • value (::Array[Orb::Discount::TieredPercentage::Tier])

Returns:



32
# File 'lib/orb/models/discount.rb', line 32

required :tiers, -> { Orb::Internal::Type::ArrayOf[Orb::Discount::TieredPercentage::Tier] }

Instance Method Details

#to_hash{

Returns:

  • ({)


41
# File 'sig/orb/models/discount.rbs', line 41

def to_hash: -> {