Module: Orb::Models::MutatedSubscription::DiscountInterval

Extended by:
Internal::Type::Union
Defined in:
lib/orb/models/mutated_subscription.rb,
sig/orb/models/mutated_subscription.rbs

Defined Under Namespace

Classes: TieredPercentage

Instance Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type, variants, variants

Methods included from Internal::Util::SorbetRuntimeSupport

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

Methods included from Internal::Type::Converter

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

Instance Method Details

#initialize(id:, active_plan_phase_order:, adjustment_intervals:, auto_collection:, auto_issuance:, billing_cycle_anchor_configuration:, billing_cycle_day:, created_at:, current_billing_period_end_date:, current_billing_period_start_date:, customer:, default_invoice_memo:, discount_intervals:, end_date:, fixed_fee_quantity_schedule:, invoicing_threshold:, maximum_intervals:, metadata:, minimum_intervals:, name:, net_terms:, pending_subscription_change:, plan:, price_intervals:, redeemed_coupon:, start_date:, status:, trial_info:, changed_resources: nil) ⇒ Object

Some parameter documentations has been truncated, see Orb::Models::MutatedSubscription for more details.

Parameters:



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/orb/models/mutated_subscription.rb', line 288

module DiscountInterval
  extend Orb::Internal::Type::Union

  discriminator :discount_type

  variant :amount, -> { Orb::AmountDiscountInterval }

  variant :percentage, -> { Orb::PercentageDiscountInterval }

  variant :usage, -> { Orb::UsageDiscountInterval }

  variant :tiered_percentage, -> { Orb::MutatedSubscription::DiscountInterval::TieredPercentage }

  class TieredPercentage < Orb::Internal::Type::BaseModel
    # @!attribute applies_to_price_interval_ids
    #   The price interval ids that this discount interval applies to.
    #
    #   @return [Array<String>]
    required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String]

    # @!attribute discount_type
    #
    #   @return [Symbol, :tiered_percentage]
    required :discount_type, const: :tiered_percentage

    # @!attribute end_date
    #   The end date of the discount interval.
    #
    #   @return [Time, nil]
    required :end_date, Time, nil?: true

    # @!attribute filters
    #   The filters that determine which prices this discount interval applies to.
    #
    #   @return [Array<Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter>]
    required :filters,
             -> { Orb::Internal::Type::ArrayOf[Orb::MutatedSubscription::DiscountInterval::TieredPercentage::Filter] }

    # @!attribute start_date
    #   The start date of the discount interval.
    #
    #   @return [Time]
    required :start_date, Time

    # @!attribute tiers
    #   Only available if discount_type is `tiered_percentage`. The ordered, contiguous
    #   bands of cumulative eligible spend, each discounted at its own percentage.
    #
    #   @return [Array<Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Tier>]
    required :tiers,
             -> { Orb::Internal::Type::ArrayOf[Orb::MutatedSubscription::DiscountInterval::TieredPercentage::Tier] }

    # @!method initialize(applies_to_price_interval_ids:, end_date:, filters:, start_date:, tiers:, discount_type: :tiered_percentage)
    #   Some parameter documentations has been truncated, see
    #   {Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage} for more
    #   details.
    #
    #   @param applies_to_price_interval_ids [Array<String>] The price interval ids that this discount interval applies to.
    #
    #   @param end_date [Time, nil] The end date of the discount interval.
    #
    #   @param filters [Array<Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter>] The filters that determine which prices this discount interval applies to.
    #
    #   @param start_date [Time] The start date of the discount interval.
    #
    #   @param tiers [Array<Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Tier>] Only available if discount_type is `tiered_percentage`. The ordered, contiguous
    #
    #   @param discount_type [Symbol, :tiered_percentage]

    class Filter < Orb::Internal::Type::BaseModel
      # @!attribute field
      #   The property of the price to filter on.
      #
      #   @return [Symbol, Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter::Field]
      required :field, enum: -> { Orb::MutatedSubscription::DiscountInterval::TieredPercentage::Filter::Field }

      # @!attribute operator
      #   Should prices that match the filter be included or excluded.
      #
      #   @return [Symbol, Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter::Operator]
      required :operator,
               enum: -> { Orb::MutatedSubscription::DiscountInterval::TieredPercentage::Filter::Operator }

      # @!attribute values
      #   The IDs or values that match this filter.
      #
      #   @return [Array<String>]
      required :values, Orb::Internal::Type::ArrayOf[String]

      # @!method initialize(field:, operator:, values:)
      #   @param field [Symbol, Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter::Field] The property of the price to filter on.
      #
      #   @param operator [Symbol, Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter::Operator] Should prices that match the filter be included or excluded.
      #
      #   @param values [Array<String>] The IDs or values that match this filter.

      # The property of the price to filter on.
      #
      # @see Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter#field
      module Field
        extend Orb::Internal::Type::Enum

        PRICE_ID = :price_id
        ITEM_ID = :item_id
        PRICE_TYPE = :price_type
        CURRENCY = :currency
        PRICING_UNIT_ID = :pricing_unit_id

        # @!method self.values
        #   @return [Array<Symbol>]
      end

      # Should prices that match the filter be included or excluded.
      #
      # @see Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::Filter#operator
      module Operator
        extend Orb::Internal::Type::Enum

        INCLUDES = :includes
        EXCLUDES = :excludes

        # @!method self.values
        #   @return [Array<Symbol>]
      end
    end

    class Tier < Orb::Internal::Type::BaseModel
      # @!attribute lower_bound
      #   Exclusive lower bound of cumulative spend for this tier.
      #
      #   @return [Float]
      required :lower_bound, Float

      # @!attribute percentage
      #   The percentage (between 0 and 1) discounted from spend that falls within this
      #   tier.
      #
      #   @return [Float]
      required :percentage, Float

      # @!attribute upper_bound
      #   Inclusive upper bound of cumulative spend for this tier; null for the final
      #   open-ended tier.
      #
      #   @return [Float, nil]
      optional :upper_bound, Float, nil?: true

      # @!method initialize(lower_bound:, percentage:, upper_bound: nil)
      #   Some parameter documentations has been truncated, see
      #   {Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage::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.
      #
      #   @param lower_bound [Float] Exclusive lower bound of cumulative spend for this tier.
      #
      #   @param percentage [Float] The percentage (between 0 and 1) discounted from spend that falls within this ti
      #
      #   @param upper_bound [Float, nil] Inclusive upper bound of cumulative spend for this tier; null for the final open
    end
  end

  # @!method self.variants
  #   @return [Array(Orb::Models::AmountDiscountInterval, Orb::Models::PercentageDiscountInterval, Orb::Models::UsageDiscountInterval, Orb::Models::MutatedSubscription::DiscountInterval::TieredPercentage)]
end

#self?.variants::Array[Orb::Models::MutatedSubscription::discount_interval]

Returns:

  • (::Array[Orb::Models::MutatedSubscription::discount_interval])


286
# File 'sig/orb/models/mutated_subscription.rbs', line 286

def self?.variants: -> ::Array[Orb::Models::MutatedSubscription::discount_interval]