Module: Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem

Extended by:
Internal::Type::Union
Defined in:
lib/dodopayments/models/subscription_preview_change_plan_response.rb

Defined Under Namespace

Classes: Addon, Meter, Subscription

Instance Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, 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(id:, currency:, name:, proration_factor:, quantity:, tax_category:, tax_inclusive:, tax_rate:, unit_price:, description: nil, tax: nil, type: :addon) ⇒ Object

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

Parameters:

  • id (String)
  • currency (Symbol, Dodopayments::Models::Currency)
  • name (String)
  • proration_factor (Float)
  • quantity (Integer)
  • tax_category (Symbol, Dodopayments::Models::TaxCategory)

    Represents the different categories of taxation applicable to various products a

  • tax_inclusive (Boolean)
  • tax_rate (Float)
  • unit_price (Integer)
  • description (String, nil) (defaults to: nil)
  • tax (Integer, nil) (defaults to: nil)
  • type (Symbol, :addon) (defaults to: :addon)


51
52
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
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
# File 'lib/dodopayments/models/subscription_preview_change_plan_response.rb', line 51

module LineItem
  extend Dodopayments::Internal::Type::Union

  discriminator :type

  variant :subscription,
          -> { Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Subscription }

  variant :addon,
          -> { Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Addon }

  variant :meter,
          -> { Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Meter }

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

    # @!attribute currency
    #
    #   @return [Symbol, Dodopayments::Models::Currency]
    required :currency, enum: -> { Dodopayments::Currency }

    # @!attribute product_id
    #
    #   @return [String]
    required :product_id, String

    # @!attribute proration_factor
    #
    #   @return [Float]
    required :proration_factor, Float

    # @!attribute quantity
    #
    #   @return [Integer]
    required :quantity, Integer

    # @!attribute tax_inclusive
    #
    #   @return [Boolean]
    required :tax_inclusive, Dodopayments::Internal::Type::Boolean

    # @!attribute type
    #
    #   @return [Symbol, :subscription]
    required :type, const: :subscription

    # @!attribute unit_price
    #
    #   @return [Integer]
    required :unit_price, Integer

    # @!attribute description
    #
    #   @return [String, nil]
    optional :description, String, nil?: true

    # @!attribute name
    #
    #   @return [String, nil]
    optional :name, String, nil?: true

    # @!attribute tax
    #
    #   @return [Integer, nil]
    optional :tax, Integer, nil?: true

    # @!attribute tax_rate
    #
    #   @return [Float, nil]
    optional :tax_rate, Float, nil?: true

    # @!method initialize(id:, currency:, product_id:, proration_factor:, quantity:, tax_inclusive:, unit_price:, description: nil, name: nil, tax: nil, tax_rate: nil, type: :subscription)
    #   @param id [String]
    #   @param currency [Symbol, Dodopayments::Models::Currency]
    #   @param product_id [String]
    #   @param proration_factor [Float]
    #   @param quantity [Integer]
    #   @param tax_inclusive [Boolean]
    #   @param unit_price [Integer]
    #   @param description [String, nil]
    #   @param name [String, nil]
    #   @param tax [Integer, nil]
    #   @param tax_rate [Float, nil]
    #   @param type [Symbol, :subscription]
  end

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

    # @!attribute currency
    #
    #   @return [Symbol, Dodopayments::Models::Currency]
    required :currency, enum: -> { Dodopayments::Currency }

    # @!attribute name
    #
    #   @return [String]
    required :name, String

    # @!attribute proration_factor
    #
    #   @return [Float]
    required :proration_factor, Float

    # @!attribute quantity
    #
    #   @return [Integer]
    required :quantity, Integer

    # @!attribute tax_category
    #   Represents the different categories of taxation applicable to various products
    #   and services.
    #
    #   @return [Symbol, Dodopayments::Models::TaxCategory]
    required :tax_category, enum: -> { Dodopayments::TaxCategory }

    # @!attribute tax_inclusive
    #
    #   @return [Boolean]
    required :tax_inclusive, Dodopayments::Internal::Type::Boolean

    # @!attribute tax_rate
    #
    #   @return [Float]
    required :tax_rate, Float

    # @!attribute type
    #
    #   @return [Symbol, :addon]
    required :type, const: :addon

    # @!attribute unit_price
    #
    #   @return [Integer]
    required :unit_price, Integer

    # @!attribute description
    #
    #   @return [String, nil]
    optional :description, String, nil?: true

    # @!attribute tax
    #
    #   @return [Integer, nil]
    optional :tax, Integer, nil?: true

    # @!method initialize(id:, currency:, name:, proration_factor:, quantity:, tax_category:, tax_inclusive:, tax_rate:, unit_price:, description: nil, tax: nil, type: :addon)
    #   Some parameter documentations has been truncated, see
    #   {Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Addon}
    #   for more details.
    #
    #   @param id [String]
    #
    #   @param currency [Symbol, Dodopayments::Models::Currency]
    #
    #   @param name [String]
    #
    #   @param proration_factor [Float]
    #
    #   @param quantity [Integer]
    #
    #   @param tax_category [Symbol, Dodopayments::Models::TaxCategory] Represents the different categories of taxation applicable to various products a
    #
    #   @param tax_inclusive [Boolean]
    #
    #   @param tax_rate [Float]
    #
    #   @param unit_price [Integer]
    #
    #   @param description [String, nil]
    #
    #   @param tax [Integer, nil]
    #
    #   @param type [Symbol, :addon]
  end

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

    # @!attribute chargeable_units
    #
    #   @return [String]
    required :chargeable_units, String

    # @!attribute currency
    #
    #   @return [Symbol, Dodopayments::Models::Currency]
    required :currency, enum: -> { Dodopayments::Currency }

    # @!attribute free_threshold
    #
    #   @return [Integer]
    required :free_threshold, Integer

    # @!attribute name
    #
    #   @return [String]
    required :name, String

    # @!attribute price_per_unit
    #
    #   @return [String]
    required :price_per_unit, String

    # @!attribute subtotal
    #
    #   @return [Integer]
    required :subtotal, Integer

    # @!attribute tax_inclusive
    #
    #   @return [Boolean]
    required :tax_inclusive, Dodopayments::Internal::Type::Boolean

    # @!attribute tax_rate
    #
    #   @return [Float]
    required :tax_rate, Float

    # @!attribute type
    #
    #   @return [Symbol, :meter]
    required :type, const: :meter

    # @!attribute units_consumed
    #
    #   @return [String]
    required :units_consumed, String

    # @!attribute description
    #
    #   @return [String, nil]
    optional :description, String, nil?: true

    # @!attribute tax
    #
    #   @return [Integer, nil]
    optional :tax, Integer, nil?: true

    # @!method initialize(id:, chargeable_units:, currency:, free_threshold:, name:, price_per_unit:, subtotal:, tax_inclusive:, tax_rate:, units_consumed:, description: nil, tax: nil, type: :meter)
    #   @param id [String]
    #   @param chargeable_units [String]
    #   @param currency [Symbol, Dodopayments::Models::Currency]
    #   @param free_threshold [Integer]
    #   @param name [String]
    #   @param price_per_unit [String]
    #   @param subtotal [Integer]
    #   @param tax_inclusive [Boolean]
    #   @param tax_rate [Float]
    #   @param units_consumed [String]
    #   @param description [String, nil]
    #   @param tax [Integer, nil]
    #   @param type [Symbol, :meter]
  end

  # @!method self.variants
  #   @return [Array(Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Subscription, Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Addon, Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::LineItem::Meter)]
end