Module: Orb::Models::PlanVersion::Adjustment

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

Defined Under Namespace

Classes: TieredPercentageDiscount

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type, 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(adjustments:, created_at:, plan_phases:, prices:, version:) ⇒ Object

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

The PlanVersion resource represents the prices and adjustments present on a specific version of a plan.

Parameters:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/orb/models/plan_version.rb', line 53

module Adjustment
  extend Orb::Internal::Type::Union

  discriminator :adjustment_type

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

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

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

  variant :tiered_percentage_discount, -> { Orb::PlanVersion::Adjustment::TieredPercentageDiscount }

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

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

  class TieredPercentageDiscount < Orb::Internal::Type::BaseModel
    # @!attribute id
    #
    #   @return [String]
    required :id, String

    # @!attribute adjustment_type
    #
    #   @return [Symbol, :tiered_percentage_discount]
    required :adjustment_type, const: :tiered_percentage_discount

    # @!attribute applies_to_price_ids
    #   @deprecated
    #
    #   The price IDs that this adjustment applies to.
    #
    #   @return [Array<String>]
    required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String]

    # @!attribute filters
    #   The filters that determine which prices to apply this adjustment to.
    #
    #   @return [Array<Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount::Filter>]
    required :filters,
             -> { Orb::Internal::Type::ArrayOf[Orb::PlanVersion::Adjustment::TieredPercentageDiscount::Filter] }

    # @!attribute is_invoice_level
    #   True for adjustments that apply to an entire invoice, false for adjustments that
    #   apply to only one price.
    #
    #   @return [Boolean]
    required :is_invoice_level, Orb::Internal::Type::Boolean

    # @!attribute plan_phase_order
    #   The plan phase in which this adjustment is active.
    #
    #   @return [Integer, nil]
    required :plan_phase_order, Integer, nil?: true

    # @!attribute reason
    #   The reason for the adjustment.
    #
    #   @return [String, nil]
    required :reason, String, nil?: true

    # @!attribute replaces_adjustment_id
    #   The adjustment id this adjustment replaces. This adjustment will take the place
    #   of the replaced adjustment in plan version migrations.
    #
    #   @return [String, nil]
    required :replaces_adjustment_id, String, nil?: true

    # @!attribute tiers
    #   The ordered, contiguous bands of cumulative eligible spend, each discounted at
    #   its own percentage (progressive fill-a-tier), applied to the prices this
    #   adjustment covers in a given billing period.
    #
    #   @return [Array<Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount::Tier>]
    required :tiers,
             -> { Orb::Internal::Type::ArrayOf[Orb::PlanVersion::Adjustment::TieredPercentageDiscount::Tier] }

    # @!method initialize(id:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, replaces_adjustment_id:, tiers:, adjustment_type: :tiered_percentage_discount)
    #   Some parameter documentations has been truncated, see
    #   {Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount} for more
    #   details.
    #
    #   @param id [String]
    #
    #   @param applies_to_price_ids [Array<String>] The price IDs that this adjustment applies to.
    #
    #   @param filters [Array<Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount::Filter>] The filters that determine which prices to apply this adjustment to.
    #
    #   @param is_invoice_level [Boolean] True for adjustments that apply to an entire invoice, false for adjustments that
    #
    #   @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active.
    #
    #   @param reason [String, nil] The reason for the adjustment.
    #
    #   @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
    #
    #   @param tiers [Array<Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount::Tier>] The ordered, contiguous bands of cumulative eligible spend, each discounted at i
    #
    #   @param adjustment_type [Symbol, :tiered_percentage_discount]

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

      # @!attribute operator
      #   Should prices that match the filter be included or excluded.
      #
      #   @return [Symbol, Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount::Filter::Operator]
      required :operator, enum: -> { Orb::PlanVersion::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::PlanVersion::Adjustment::TieredPercentageDiscount::Filter::Field] The property of the price to filter on.
      #
      #   @param operator [Symbol, Orb::Models::PlanVersion::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::PlanVersion::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::PlanVersion::Adjustment::TieredPercentageDiscount::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::PlanVersion::Adjustment::TieredPercentageDiscount::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::PlanPhaseUsageDiscountAdjustment, Orb::Models::PlanPhaseAmountDiscountAdjustment, Orb::Models::PlanPhasePercentageDiscountAdjustment, Orb::Models::PlanVersion::Adjustment::TieredPercentageDiscount, Orb::Models::PlanPhaseMinimumAdjustment, Orb::Models::PlanPhaseMaximumAdjustment)]
end

#self?.variants::Array[Orb::Models::PlanVersion::adjustment]

Returns:

  • (::Array[Orb::Models::PlanVersion::adjustment])


183
# File 'sig/orb/models/plan_version.rbs', line 183

def self?.variants: -> ::Array[Orb::Models::PlanVersion::adjustment]