Class: Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/orb/models/beta/external_plan_id_create_plan_version_params.rb,
sig/orb/models/beta/external_plan_id_create_plan_version_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:, plan_phase_order: nil) ⇒ Object

Parameters:



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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
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
# File 'lib/orb/models/beta/external_plan_id_create_plan_version_params.rb', line 109

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

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

  # @!method initialize(adjustment:, plan_phase_order: nil)
  #   @param adjustment [Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum, Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount] The definition of a new adjustment to create and add to the plan.
  #
  #   @param plan_phase_order [Integer, nil] The phase to add this adjustment to.

  # The definition of a new adjustment to create and add to the plan.
  #
  # @see Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Tier>]
      required :tiers,
               -> do
                 Orb::Internal::Type::ArrayOf[
                   Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Tier
                 ]
               end

      # @!attribute applies_to_all
      #   If set, the adjustment will apply to every price on the subscription.
      #
      #   @return [Boolean, Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::AppliesToAll, nil]
      optional :applies_to_all,
               enum: -> {
                 Orb::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter>, nil]
      optional :filters,
               -> do
                 Orb::Internal::Type::ArrayOf[
                   Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter
                 ]
               end,
               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::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::PriceType, nil]
      optional :price_type,
               enum: -> {
                 Orb::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount}
      #   for more details.
      #
      #   @param tiers [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Tier>]
      #
      #   @param applies_to_all [Boolean, Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::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::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter::Field]
        required :field,
                 enum: -> { Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::Adjustment::TieredPercentageDiscount::Filter::Field }

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

Instance Attribute Details

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

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



114
115
# File 'lib/orb/models/beta/external_plan_id_create_plan_version_params.rb', line 114

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

#plan_phase_orderInteger?

The phase to add this adjustment to.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


121
# File 'lib/orb/models/beta/external_plan_id_create_plan_version_params.rb', line 121

optional :plan_phase_order, Integer, nil?: true

Instance Method Details

#to_hash{

Returns:

  • ({)


82
# File 'sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs', line 82

def to_hash: -> {