cbox_billing 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cbox_billing/api/checkout_portal_api.rb +214 -0
  3. data/lib/cbox_billing/api/coupons_api.rb +55 -55
  4. data/lib/cbox_billing/api/experiments_api.rb +526 -0
  5. data/lib/cbox_billing/api/organizations_api.rb +554 -0
  6. data/lib/cbox_billing/api/pricing_tables_api.rb +519 -0
  7. data/lib/cbox_billing/api/retention_api.rb +884 -0
  8. data/lib/cbox_billing/api/sellers_api.rb +590 -0
  9. data/lib/cbox_billing/models/checkout_link.rb +283 -0
  10. data/lib/cbox_billing/models/conclude_experiment_request.rb +161 -0
  11. data/lib/cbox_billing/models/create_checkout_link_request.rb +178 -0
  12. data/lib/cbox_billing/models/customer_lifecycle_refusal.rb +238 -0
  13. data/lib/cbox_billing/models/customer_lifecycle_state.rb +268 -0
  14. data/lib/cbox_billing/models/delete_experiment200_response.rb +227 -0
  15. data/lib/cbox_billing/models/delete_organization200_response.rb +227 -0
  16. data/lib/cbox_billing/models/experiment.rb +387 -0
  17. data/lib/cbox_billing/models/experiment_input.rb +410 -0
  18. data/lib/cbox_billing/models/experiment_input_variants_inner.rb +233 -0
  19. data/lib/cbox_billing/models/experiment_variant.rb +266 -0
  20. data/lib/cbox_billing/models/list_checkout_links200_response.rb +179 -0
  21. data/lib/cbox_billing/models/list_checkout_links200_response_data_inner.rb +223 -0
  22. data/lib/cbox_billing/models/list_experiments200_response.rb +179 -0
  23. data/lib/cbox_billing/models/list_pricing_tables200_response.rb +179 -0
  24. data/lib/cbox_billing/models/list_retention_offers200_response.rb +179 -0
  25. data/lib/cbox_billing/models/list_retention_reasons200_response.rb +179 -0
  26. data/lib/cbox_billing/models/list_sellers200_response.rb +179 -0
  27. data/lib/cbox_billing/models/merge_organization_request.rb +221 -0
  28. data/lib/cbox_billing/models/merge_organization_request_fields.rb +279 -0
  29. data/lib/cbox_billing/models/preview_organization_merge200_response.rb +343 -0
  30. data/lib/cbox_billing/models/preview_organization_merge_request.rb +177 -0
  31. data/lib/cbox_billing/models/pricing_table.rb +426 -0
  32. data/lib/cbox_billing/models/pricing_table_column.rb +248 -0
  33. data/lib/cbox_billing/models/pricing_table_input.rb +388 -0
  34. data/lib/cbox_billing/models/retention_offer.rb +389 -0
  35. data/lib/cbox_billing/models/retention_offer_input.rb +447 -0
  36. data/lib/cbox_billing/models/retention_reason.rb +282 -0
  37. data/lib/cbox_billing/models/retention_reason_input.rb +195 -0
  38. data/lib/cbox_billing/models/revoke_checkout_link200_response.rb +227 -0
  39. data/lib/cbox_billing/models/seller.rb +551 -0
  40. data/lib/cbox_billing/models/seller_address.rb +201 -0
  41. data/lib/cbox_billing/models/seller_bank.rb +191 -0
  42. data/lib/cbox_billing/models/seller_input.rb +633 -0
  43. data/lib/cbox_billing/models/seller_input_registrations_inner.rb +188 -0
  44. data/lib/cbox_billing/models/seller_registrations_inner.rb +189 -0
  45. data/lib/cbox_billing/models/suspend_organization_request.rb +179 -0
  46. data/lib/cbox_billing/version.rb +1 -1
  47. data/lib/cbox_billing.rb +41 -0
  48. metadata +42 -1
@@ -0,0 +1,447 @@
1
+ =begin
2
+ #Cbox Billing API
3
+
4
+ #The HTTP API of Cbox Billing. Reference: https://github.com/cboxdk/cbox-billing/tree/main/docs/api
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CboxBilling
17
+ class RetentionOfferInput < ApiModelBase
18
+ attr_accessor :label
19
+
20
+ attr_accessor :type
21
+
22
+ # Required for discount.
23
+ attr_accessor :discount_percent
24
+
25
+ # Required for discount.
26
+ attr_accessor :duration_cycles
27
+
28
+ # Required for free_month.
29
+ attr_accessor :free_months
30
+
31
+ # Required for pause.
32
+ attr_accessor :pause_cycles
33
+
34
+ # free_month only: an amount in money, such as 99.00.
35
+ attr_accessor :credit
36
+
37
+ # The currency of the credit.
38
+ attr_accessor :currency
39
+
40
+ # Required for downgrade: a product key in the catalog.
41
+ attr_accessor :target_product_id
42
+
43
+ # Required for downgrade: one of that product's price ids.
44
+ attr_accessor :target_price_id
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'label' => :'label',
72
+ :'type' => :'type',
73
+ :'discount_percent' => :'discountPercent',
74
+ :'duration_cycles' => :'durationCycles',
75
+ :'free_months' => :'freeMonths',
76
+ :'pause_cycles' => :'pauseCycles',
77
+ :'credit' => :'credit',
78
+ :'currency' => :'currency',
79
+ :'target_product_id' => :'targetProductId',
80
+ :'target_price_id' => :'targetPriceId'
81
+ }
82
+ end
83
+
84
+ # Returns attribute mapping this model knows about
85
+ def self.acceptable_attribute_map
86
+ attribute_map
87
+ end
88
+
89
+ # Returns all the JSON keys this model knows about
90
+ def self.acceptable_attributes
91
+ acceptable_attribute_map.values
92
+ end
93
+
94
+ # Attribute type mapping.
95
+ def self.openapi_types
96
+ {
97
+ :'label' => :'String',
98
+ :'type' => :'String',
99
+ :'discount_percent' => :'Integer',
100
+ :'duration_cycles' => :'Integer',
101
+ :'free_months' => :'Integer',
102
+ :'pause_cycles' => :'Integer',
103
+ :'credit' => :'String',
104
+ :'currency' => :'String',
105
+ :'target_product_id' => :'String',
106
+ :'target_price_id' => :'String'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ ])
114
+ end
115
+
116
+ # Returns attribute type mapping
117
+ def self.acceptable_openapi_types
118
+ openapi_types
119
+ end
120
+
121
+ # Returns the nullable attributes
122
+ def self.acceptable_openapi_nullable
123
+ openapi_nullable
124
+ end
125
+
126
+ # Initializes the object
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ def initialize(attributes = {})
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CboxBilling::RetentionOfferInput` initialize method"
131
+ end
132
+
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ acceptable_attribute_map = self.class.acceptable_attribute_map
135
+ attributes = attributes.each_with_object({}) { |(k, v), h|
136
+ if (!acceptable_attribute_map.key?(k.to_sym))
137
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CboxBilling::RetentionOfferInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
138
+ end
139
+ h[k.to_sym] = v
140
+ }
141
+
142
+ if attributes.key?(:'label')
143
+ self.label = attributes[:'label']
144
+ else
145
+ self.label = nil
146
+ end
147
+
148
+ if attributes.key?(:'type')
149
+ self.type = attributes[:'type']
150
+ else
151
+ self.type = nil
152
+ end
153
+
154
+ if attributes.key?(:'discount_percent')
155
+ self.discount_percent = attributes[:'discount_percent']
156
+ end
157
+
158
+ if attributes.key?(:'duration_cycles')
159
+ self.duration_cycles = attributes[:'duration_cycles']
160
+ end
161
+
162
+ if attributes.key?(:'free_months')
163
+ self.free_months = attributes[:'free_months']
164
+ end
165
+
166
+ if attributes.key?(:'pause_cycles')
167
+ self.pause_cycles = attributes[:'pause_cycles']
168
+ end
169
+
170
+ if attributes.key?(:'credit')
171
+ self.credit = attributes[:'credit']
172
+ end
173
+
174
+ if attributes.key?(:'currency')
175
+ self.currency = attributes[:'currency']
176
+ end
177
+
178
+ if attributes.key?(:'target_product_id')
179
+ self.target_product_id = attributes[:'target_product_id']
180
+ end
181
+
182
+ if attributes.key?(:'target_price_id')
183
+ self.target_price_id = attributes[:'target_price_id']
184
+ end
185
+ end
186
+
187
+ # Show invalid properties with the reasons. Usually used together with valid?
188
+ # @return Array for valid properties with the reasons
189
+ def list_invalid_properties
190
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
191
+ invalid_properties = Array.new
192
+ if @label.nil?
193
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
194
+ end
195
+
196
+ if @label.to_s.length > 255
197
+ invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 255.')
198
+ end
199
+
200
+ if @type.nil?
201
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
202
+ end
203
+
204
+ if !@discount_percent.nil? && @discount_percent > 100
205
+ invalid_properties.push('invalid value for "discount_percent", must be smaller than or equal to 100.')
206
+ end
207
+
208
+ if !@discount_percent.nil? && @discount_percent < 1
209
+ invalid_properties.push('invalid value for "discount_percent", must be greater than or equal to 1.')
210
+ end
211
+
212
+ if !@duration_cycles.nil? && @duration_cycles > 120
213
+ invalid_properties.push('invalid value for "duration_cycles", must be smaller than or equal to 120.')
214
+ end
215
+
216
+ if !@duration_cycles.nil? && @duration_cycles < 1
217
+ invalid_properties.push('invalid value for "duration_cycles", must be greater than or equal to 1.')
218
+ end
219
+
220
+ if !@free_months.nil? && @free_months > 24
221
+ invalid_properties.push('invalid value for "free_months", must be smaller than or equal to 24.')
222
+ end
223
+
224
+ if !@free_months.nil? && @free_months < 1
225
+ invalid_properties.push('invalid value for "free_months", must be greater than or equal to 1.')
226
+ end
227
+
228
+ if !@pause_cycles.nil? && @pause_cycles > 24
229
+ invalid_properties.push('invalid value for "pause_cycles", must be smaller than or equal to 24.')
230
+ end
231
+
232
+ if !@pause_cycles.nil? && @pause_cycles < 1
233
+ invalid_properties.push('invalid value for "pause_cycles", must be greater than or equal to 1.')
234
+ end
235
+
236
+ if !@credit.nil? && @credit.to_s.length > 32
237
+ invalid_properties.push('invalid value for "credit", the character length must be smaller than or equal to 32.')
238
+ end
239
+
240
+ invalid_properties
241
+ end
242
+
243
+ # Check to see if the all the properties in the model are valid
244
+ # @return true if the model is valid
245
+ def valid?
246
+ warn '[DEPRECATED] the `valid?` method is obsolete'
247
+ return false if @label.nil?
248
+ return false if @label.to_s.length > 255
249
+ return false if @type.nil?
250
+ type_validator = EnumAttributeValidator.new('String', ["discount", "free_month", "pause", "downgrade", "custom"])
251
+ return false unless type_validator.valid?(@type)
252
+ return false if !@discount_percent.nil? && @discount_percent > 100
253
+ return false if !@discount_percent.nil? && @discount_percent < 1
254
+ return false if !@duration_cycles.nil? && @duration_cycles > 120
255
+ return false if !@duration_cycles.nil? && @duration_cycles < 1
256
+ return false if !@free_months.nil? && @free_months > 24
257
+ return false if !@free_months.nil? && @free_months < 1
258
+ return false if !@pause_cycles.nil? && @pause_cycles > 24
259
+ return false if !@pause_cycles.nil? && @pause_cycles < 1
260
+ return false if !@credit.nil? && @credit.to_s.length > 32
261
+ true
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] label Value to be assigned
266
+ def label=(label)
267
+ if label.nil?
268
+ fail ArgumentError, 'label cannot be nil'
269
+ end
270
+
271
+ if label.to_s.length > 255
272
+ fail ArgumentError, 'invalid value for "label", the character length must be smaller than or equal to 255.'
273
+ end
274
+
275
+ @label = label
276
+ end
277
+
278
+ # Custom attribute writer method checking allowed values (enum).
279
+ # @param [Object] type Object to be assigned
280
+ def type=(type)
281
+ validator = EnumAttributeValidator.new('String', ["discount", "free_month", "pause", "downgrade", "custom"])
282
+ unless validator.valid?(type)
283
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
284
+ end
285
+ @type = type
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] discount_percent Value to be assigned
290
+ def discount_percent=(discount_percent)
291
+ if discount_percent.nil?
292
+ fail ArgumentError, 'discount_percent cannot be nil'
293
+ end
294
+
295
+ if discount_percent > 100
296
+ fail ArgumentError, 'invalid value for "discount_percent", must be smaller than or equal to 100.'
297
+ end
298
+
299
+ if discount_percent < 1
300
+ fail ArgumentError, 'invalid value for "discount_percent", must be greater than or equal to 1.'
301
+ end
302
+
303
+ @discount_percent = discount_percent
304
+ end
305
+
306
+ # Custom attribute writer method with validation
307
+ # @param [Object] duration_cycles Value to be assigned
308
+ def duration_cycles=(duration_cycles)
309
+ if duration_cycles.nil?
310
+ fail ArgumentError, 'duration_cycles cannot be nil'
311
+ end
312
+
313
+ if duration_cycles > 120
314
+ fail ArgumentError, 'invalid value for "duration_cycles", must be smaller than or equal to 120.'
315
+ end
316
+
317
+ if duration_cycles < 1
318
+ fail ArgumentError, 'invalid value for "duration_cycles", must be greater than or equal to 1.'
319
+ end
320
+
321
+ @duration_cycles = duration_cycles
322
+ end
323
+
324
+ # Custom attribute writer method with validation
325
+ # @param [Object] free_months Value to be assigned
326
+ def free_months=(free_months)
327
+ if free_months.nil?
328
+ fail ArgumentError, 'free_months cannot be nil'
329
+ end
330
+
331
+ if free_months > 24
332
+ fail ArgumentError, 'invalid value for "free_months", must be smaller than or equal to 24.'
333
+ end
334
+
335
+ if free_months < 1
336
+ fail ArgumentError, 'invalid value for "free_months", must be greater than or equal to 1.'
337
+ end
338
+
339
+ @free_months = free_months
340
+ end
341
+
342
+ # Custom attribute writer method with validation
343
+ # @param [Object] pause_cycles Value to be assigned
344
+ def pause_cycles=(pause_cycles)
345
+ if pause_cycles.nil?
346
+ fail ArgumentError, 'pause_cycles cannot be nil'
347
+ end
348
+
349
+ if pause_cycles > 24
350
+ fail ArgumentError, 'invalid value for "pause_cycles", must be smaller than or equal to 24.'
351
+ end
352
+
353
+ if pause_cycles < 1
354
+ fail ArgumentError, 'invalid value for "pause_cycles", must be greater than or equal to 1.'
355
+ end
356
+
357
+ @pause_cycles = pause_cycles
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] credit Value to be assigned
362
+ def credit=(credit)
363
+ if credit.nil?
364
+ fail ArgumentError, 'credit cannot be nil'
365
+ end
366
+
367
+ if credit.to_s.length > 32
368
+ fail ArgumentError, 'invalid value for "credit", the character length must be smaller than or equal to 32.'
369
+ end
370
+
371
+ @credit = credit
372
+ end
373
+
374
+ # Checks equality by comparing each attribute.
375
+ # @param [Object] Object to be compared
376
+ def ==(o)
377
+ return true if self.equal?(o)
378
+ self.class == o.class &&
379
+ label == o.label &&
380
+ type == o.type &&
381
+ discount_percent == o.discount_percent &&
382
+ duration_cycles == o.duration_cycles &&
383
+ free_months == o.free_months &&
384
+ pause_cycles == o.pause_cycles &&
385
+ credit == o.credit &&
386
+ currency == o.currency &&
387
+ target_product_id == o.target_product_id &&
388
+ target_price_id == o.target_price_id
389
+ end
390
+
391
+ # @see the `==` method
392
+ # @param [Object] Object to be compared
393
+ def eql?(o)
394
+ self == o
395
+ end
396
+
397
+ # Calculates hash code according to all attributes.
398
+ # @return [Integer] Hash code
399
+ def hash
400
+ [label, type, discount_percent, duration_cycles, free_months, pause_cycles, credit, currency, target_product_id, target_price_id].hash
401
+ end
402
+
403
+ # Builds the object from hash
404
+ # @param [Hash] attributes Model attributes in the form of hash
405
+ # @return [Object] Returns the model itself
406
+ def self.build_from_hash(attributes)
407
+ return nil unless attributes.is_a?(Hash)
408
+ attributes = attributes.transform_keys(&:to_sym)
409
+ # include attributes inherited from allOf parents (the nearest declaration wins)
410
+ map = acceptable_attribute_map
411
+ transformed_hash = {}
412
+ acceptable_openapi_types.each_pair do |key, type|
413
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
414
+ transformed_hash["#{key}"] = nil
415
+ elsif type =~ /\AArray<(.*)>/i
416
+ # check to ensure the input is an array given that the attribute
417
+ # is documented as an array but the input is not
418
+ if attributes[map[key]].is_a?(Array)
419
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
420
+ end
421
+ elsif !attributes[map[key]].nil?
422
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
423
+ end
424
+ end
425
+ new(transformed_hash)
426
+ end
427
+
428
+ # Returns the object in the form of hash
429
+ # @return [Hash] Returns the object in the form of hash
430
+ def to_hash
431
+ hash = {}
432
+ # include attributes inherited from allOf parents (the nearest declaration wins)
433
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
434
+ value = self.send(attr)
435
+ if value.nil?
436
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
437
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
438
+ end
439
+
440
+ hash[param] = _to_hash(value)
441
+ end
442
+ hash
443
+ end
444
+
445
+ end
446
+
447
+ end