Class: Orb::Models::SubscriptionCreateParams::AddAdjustment

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

Defined Under Namespace

Modules: Adjustment

Constant Summary collapse

Orb =

Returns:

  • (:NewPercentageDiscount)

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(adjustment:, end_date: nil, plan_phase_order: nil, start_date: nil) ⇒ Object

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

Parameters:



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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/orb/models/subscription_create_params.rb', line 334

class AddAdjustment < Orb::Internal::Type::BaseModel
  # @!attribute adjustment
  #   The definition of a new adjustment to create and add to the subscription.
  #
  #   @return [Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount]
  required :adjustment, union: -> { Orb::SubscriptionCreateParams::AddAdjustment::Adjustment }

  # @!attribute end_date
  #   The end date of the adjustment interval. This is the date that the adjustment
  #   will stop affecting prices on the subscription.
  #
  #   @return [Time, nil]
  optional :end_date, Time, nil?: true

  # @!attribute plan_phase_order
  #   The phase to add this adjustment to.
  #
  #   @return [Integer, nil]
  optional :plan_phase_order, Integer, nil?: true

  # @!attribute start_date
  #   The start date of the adjustment interval. This is the date that the adjustment
  #   will start affecting prices on the subscription. If null, the adjustment will
  #   start when the phase or subscription starts.
  #
  #   @return [Time, nil]
  optional :start_date, Time, nil?: true

  # @!method initialize(adjustment:, end_date: nil, plan_phase_order: nil, start_date: nil)
  #   Some parameter documentations has been truncated, see
  #   {Orb::Models::SubscriptionCreateParams::AddAdjustment} for more details.
  #
  #   @param adjustment [Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount] The definition of a new adjustment to create and add to the subscription.
  #
  #   @param end_date [Time, nil] The end date of the adjustment interval. This is the date that the adjustment wi
  #
  #   @param plan_phase_order [Integer, nil] The phase to add this adjustment to.
  #
  #   @param start_date [Time, nil] The start date of the adjustment interval. This is the date that the adjustment

  # The definition of a new adjustment to create and add to the subscription.
  #
  # @see Orb::Models::SubscriptionCreateParams::AddAdjustment#adjustment
  module Adjustment
    extend Orb::Internal::Type::Union

    discriminator :adjustment_type

    variant :percentage_discount, -> { Orb::NewPercentageDiscount }

    variant :usage_discount, -> { Orb::NewUsageDiscount }

    variant :amount_discount, -> { Orb::NewAmountDiscount }

    variant :minimum, -> { Orb::NewMinimum }

    variant :maximum, -> { Orb::NewMaximum }

    variant :tiered_percentage_discount,
            -> { Orb::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount }

    class TieredPercentageDiscount < Orb::Internal::Type::BaseModel
      # @!attribute adjustment_type
      #
      #   @return [Symbol, :tiered_percentage_discount]
      required :adjustment_type, const: :tiered_percentage_discount

      # @!attribute tiers
      #
      #   @return [Array<Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Tier>]
      required :tiers,
               -> { Orb::Internal::Type::ArrayOf[Orb::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Tier] }

      # @!attribute applies_to_all
      #   If set, the adjustment will apply to every price on the subscription.
      #
      #   @return [Boolean, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::AppliesToAll, nil]
      optional :applies_to_all,
               enum: -> {
                 Orb::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::AppliesToAll
               },
               nil?: true

      # @!attribute applies_to_item_ids
      #   The set of item IDs to which this adjustment applies.
      #
      #   @return [Array<String>, nil]
      optional :applies_to_item_ids, Orb::Internal::Type::ArrayOf[String], nil?: true

      # @!attribute applies_to_price_ids
      #   The set of price IDs to which this adjustment applies.
      #
      #   @return [Array<String>, nil]
      optional :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String], nil?: true

      # @!attribute currency
      #   If set, only prices in the specified currency will have the adjustment applied.
      #
      #   @return [String, nil]
      optional :currency, String, nil?: true

      # @!attribute filters
      #   A list of filters that determine which prices this adjustment will apply to.
      #
      #   @return [Array<Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter>, nil]
      optional :filters,
               -> {
                 Orb::Internal::Type::ArrayOf[Orb::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter]
               },
               nil?: true

      # @!attribute is_invoice_level
      #   When false, this adjustment will be applied to a single price. Otherwise, it
      #   will be applied at the invoice level, possibly to multiple prices.
      #
      #   @return [Boolean, nil]
      optional :is_invoice_level, Orb::Internal::Type::Boolean

      # @!attribute price_type
      #   If set, only prices of the specified type will have the adjustment applied.
      #
      #   @return [Symbol, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::PriceType, nil]
      optional :price_type,
               enum: -> {
                 Orb::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::PriceType
               },
               nil?: true

      # @!method initialize(tiers:, applies_to_all: nil, applies_to_item_ids: nil, applies_to_price_ids: nil, currency: nil, filters: nil, is_invoice_level: nil, price_type: nil, adjustment_type: :tiered_percentage_discount)
      #   Some parameter documentations has been truncated, see
      #   {Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount}
      #   for more details.
      #
      #   @param tiers [Array<Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Tier>]
      #
      #   @param applies_to_all [Boolean, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::AppliesToAll, nil] If set, the adjustment will apply to every price on the subscription.
      #
      #   @param applies_to_item_ids [Array<String>, nil] The set of item IDs to which this adjustment applies.
      #
      #   @param applies_to_price_ids [Array<String>, nil] The set of price IDs to which this adjustment applies.
      #
      #   @param currency [String, nil] If set, only prices in the specified currency will have the adjustment applied.
      #
      #   @param filters [Array<Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter>, nil] A list of filters that determine which prices this adjustment will apply to.
      #
      #   @param is_invoice_level [Boolean] When false, this adjustment will be applied to a single price. Otherwise, it wil
      #
      #   @param price_type [Symbol, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::PriceType, nil] If set, only prices of the specified type will have the adjustment applied.
      #
      #   @param adjustment_type [Symbol, :tiered_percentage_discount]

      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 (0-1) discounted from spend in this tier.
        #
        #   @return [Float]
        required :percentage, Float

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

        # @!method initialize(lower_bound:, percentage:, upper_bound: nil)
        #   @param lower_bound [Float] Exclusive lower bound of cumulative spend for this tier.
        #
        #   @param percentage [Float] The percentage (0-1) discounted from spend in this tier.
        #
        #   @param upper_bound [Float, nil] Inclusive upper bound of cumulative spend; null for the final open-ended tier.
      end

      # If set, the adjustment will apply to every price on the subscription.
      #
      # @see Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount#applies_to_all
      module AppliesToAll
        extend Orb::Internal::Type::Enum

        TRUE = true

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

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

        # @!attribute operator
        #   Should prices that match the filter be included or excluded.
        #
        #   @return [Symbol, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter::Operator]
        required :operator,
                 enum: -> { Orb::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::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::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter::Field] The property of the price to filter on.
        #
        #   @param operator [Symbol, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::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::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::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::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter#operator
        module Operator
          extend Orb::Internal::Type::Enum

          INCLUDES = :includes
          EXCLUDES = :excludes

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

      # If set, only prices of the specified type will have the adjustment applied.
      #
      # @see Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount#price_type
      module PriceType
        extend Orb::Internal::Type::Enum

        USAGE = :usage
        FIXED_IN_ADVANCE = :fixed_in_advance
        FIXED_IN_ARREARS = :fixed_in_arrears
        FIXED = :fixed
        IN_ARREARS = :in_arrears

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

    # @!method self.variants
    #   @return [Array(Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum, Orb::Models::SubscriptionCreateParams::AddAdjustment::Adjustment::TieredPercentageDiscount)]
  end
end

Instance Attribute Details

#adjustmentOrb::Models::NewPercentageDiscount, ...

The definition of a new adjustment to create and add to the subscription.



339
# File 'lib/orb/models/subscription_create_params.rb', line 339

required :adjustment, union: -> { Orb::SubscriptionCreateParams::AddAdjustment::Adjustment }

#end_dateTime?

The end date of the adjustment interval. This is the date that the adjustment will stop affecting prices on the subscription.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


346
# File 'lib/orb/models/subscription_create_params.rb', line 346

optional :end_date, Time, nil?: true

#plan_phase_orderInteger?

The phase to add this adjustment to.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


352
# File 'lib/orb/models/subscription_create_params.rb', line 352

optional :plan_phase_order, Integer, nil?: true

#start_dateTime?

The start date of the adjustment interval. This is the date that the adjustment will start affecting prices on the subscription. If null, the adjustment will start when the phase or subscription starts.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


360
# File 'lib/orb/models/subscription_create_params.rb', line 360

optional :start_date, Time, nil?: true

Instance Method Details

#to_hash{

Returns:

  • ({)


216
# File 'sig/orb/models/subscription_create_params.rbs', line 216

def to_hash: -> {