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,389 @@
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 RetentionOffer < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ # Made from the label; redemptions carry it.
21
+ attr_accessor :key
22
+
23
+ attr_accessor :label
24
+
25
+ attr_accessor :type
26
+
27
+ attr_accessor :active
28
+
29
+ attr_accessor :discount_percent
30
+
31
+ attr_accessor :duration_cycles
32
+
33
+ attr_accessor :free_months
34
+
35
+ attr_accessor :pause_cycles
36
+
37
+ # Credit given with free months, in minor units.
38
+ attr_accessor :credit_minor
39
+
40
+ attr_accessor :currency
41
+
42
+ # The product a downgrade moves to.
43
+ attr_accessor :target_product_id
44
+
45
+ # The price a downgrade moves to.
46
+ attr_accessor :target_price_id
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'id' => :'id',
74
+ :'key' => :'key',
75
+ :'label' => :'label',
76
+ :'type' => :'type',
77
+ :'active' => :'active',
78
+ :'discount_percent' => :'discount_percent',
79
+ :'duration_cycles' => :'duration_cycles',
80
+ :'free_months' => :'free_months',
81
+ :'pause_cycles' => :'pause_cycles',
82
+ :'credit_minor' => :'credit_minor',
83
+ :'currency' => :'currency',
84
+ :'target_product_id' => :'target_product_id',
85
+ :'target_price_id' => :'target_price_id'
86
+ }
87
+ end
88
+
89
+ # Returns attribute mapping this model knows about
90
+ def self.acceptable_attribute_map
91
+ attribute_map
92
+ end
93
+
94
+ # Returns all the JSON keys this model knows about
95
+ def self.acceptable_attributes
96
+ acceptable_attribute_map.values
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'id' => :'String',
103
+ :'key' => :'String',
104
+ :'label' => :'String',
105
+ :'type' => :'String',
106
+ :'active' => :'Boolean',
107
+ :'discount_percent' => :'Integer',
108
+ :'duration_cycles' => :'Integer',
109
+ :'free_months' => :'Integer',
110
+ :'pause_cycles' => :'Integer',
111
+ :'credit_minor' => :'Integer',
112
+ :'currency' => :'String',
113
+ :'target_product_id' => :'String',
114
+ :'target_price_id' => :'String'
115
+ }
116
+ end
117
+
118
+ # List of attributes with nullable: true
119
+ def self.openapi_nullable
120
+ Set.new([
121
+ :'discount_percent',
122
+ :'duration_cycles',
123
+ :'free_months',
124
+ :'pause_cycles',
125
+ :'credit_minor',
126
+ :'currency',
127
+ :'target_product_id',
128
+ :'target_price_id'
129
+ ])
130
+ end
131
+
132
+ # Returns attribute type mapping
133
+ def self.acceptable_openapi_types
134
+ openapi_types
135
+ end
136
+
137
+ # Returns the nullable attributes
138
+ def self.acceptable_openapi_nullable
139
+ openapi_nullable
140
+ end
141
+
142
+ # Initializes the object
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ def initialize(attributes = {})
145
+ if (!attributes.is_a?(Hash))
146
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CboxBilling::RetentionOffer` initialize method"
147
+ end
148
+
149
+ # check to see if the attribute exists and convert string to symbol for hash key
150
+ acceptable_attribute_map = self.class.acceptable_attribute_map
151
+ attributes = attributes.each_with_object({}) { |(k, v), h|
152
+ if (!acceptable_attribute_map.key?(k.to_sym))
153
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CboxBilling::RetentionOffer`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
154
+ end
155
+ h[k.to_sym] = v
156
+ }
157
+
158
+ if attributes.key?(:'id')
159
+ self.id = attributes[:'id']
160
+ else
161
+ self.id = nil
162
+ end
163
+
164
+ if attributes.key?(:'key')
165
+ self.key = attributes[:'key']
166
+ else
167
+ self.key = nil
168
+ end
169
+
170
+ if attributes.key?(:'label')
171
+ self.label = attributes[:'label']
172
+ else
173
+ self.label = nil
174
+ end
175
+
176
+ if attributes.key?(:'type')
177
+ self.type = attributes[:'type']
178
+ else
179
+ self.type = nil
180
+ end
181
+
182
+ if attributes.key?(:'active')
183
+ self.active = attributes[:'active']
184
+ else
185
+ self.active = nil
186
+ end
187
+
188
+ if attributes.key?(:'discount_percent')
189
+ self.discount_percent = attributes[:'discount_percent']
190
+ end
191
+
192
+ if attributes.key?(:'duration_cycles')
193
+ self.duration_cycles = attributes[:'duration_cycles']
194
+ end
195
+
196
+ if attributes.key?(:'free_months')
197
+ self.free_months = attributes[:'free_months']
198
+ end
199
+
200
+ if attributes.key?(:'pause_cycles')
201
+ self.pause_cycles = attributes[:'pause_cycles']
202
+ end
203
+
204
+ if attributes.key?(:'credit_minor')
205
+ self.credit_minor = attributes[:'credit_minor']
206
+ end
207
+
208
+ if attributes.key?(:'currency')
209
+ self.currency = attributes[:'currency']
210
+ end
211
+
212
+ if attributes.key?(:'target_product_id')
213
+ self.target_product_id = attributes[:'target_product_id']
214
+ end
215
+
216
+ if attributes.key?(:'target_price_id')
217
+ self.target_price_id = attributes[:'target_price_id']
218
+ end
219
+ end
220
+
221
+ # Show invalid properties with the reasons. Usually used together with valid?
222
+ # @return Array for valid properties with the reasons
223
+ def list_invalid_properties
224
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
225
+ invalid_properties = Array.new
226
+ if @id.nil?
227
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
228
+ end
229
+
230
+ if @key.nil?
231
+ invalid_properties.push('invalid value for "key", key cannot be nil.')
232
+ end
233
+
234
+ if @label.nil?
235
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
236
+ end
237
+
238
+ if @type.nil?
239
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
240
+ end
241
+
242
+ if @active.nil?
243
+ invalid_properties.push('invalid value for "active", active cannot be nil.')
244
+ end
245
+
246
+ invalid_properties
247
+ end
248
+
249
+ # Check to see if the all the properties in the model are valid
250
+ # @return true if the model is valid
251
+ def valid?
252
+ warn '[DEPRECATED] the `valid?` method is obsolete'
253
+ return false if @id.nil?
254
+ return false if @key.nil?
255
+ return false if @label.nil?
256
+ return false if @type.nil?
257
+ type_validator = EnumAttributeValidator.new('String', ["discount", "free_month", "pause", "downgrade", "custom"])
258
+ return false unless type_validator.valid?(@type)
259
+ return false if @active.nil?
260
+ true
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] id Value to be assigned
265
+ def id=(id)
266
+ if id.nil?
267
+ fail ArgumentError, 'id cannot be nil'
268
+ end
269
+
270
+ @id = id
271
+ end
272
+
273
+ # Custom attribute writer method with validation
274
+ # @param [Object] key Value to be assigned
275
+ def key=(key)
276
+ if key.nil?
277
+ fail ArgumentError, 'key cannot be nil'
278
+ end
279
+
280
+ @key = key
281
+ end
282
+
283
+ # Custom attribute writer method with validation
284
+ # @param [Object] label Value to be assigned
285
+ def label=(label)
286
+ if label.nil?
287
+ fail ArgumentError, 'label cannot be nil'
288
+ end
289
+
290
+ @label = label
291
+ end
292
+
293
+ # Custom attribute writer method checking allowed values (enum).
294
+ # @param [Object] type Object to be assigned
295
+ def type=(type)
296
+ validator = EnumAttributeValidator.new('String', ["discount", "free_month", "pause", "downgrade", "custom"])
297
+ unless validator.valid?(type)
298
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
299
+ end
300
+ @type = type
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] active Value to be assigned
305
+ def active=(active)
306
+ if active.nil?
307
+ fail ArgumentError, 'active cannot be nil'
308
+ end
309
+
310
+ @active = active
311
+ end
312
+
313
+ # Checks equality by comparing each attribute.
314
+ # @param [Object] Object to be compared
315
+ def ==(o)
316
+ return true if self.equal?(o)
317
+ self.class == o.class &&
318
+ id == o.id &&
319
+ key == o.key &&
320
+ label == o.label &&
321
+ type == o.type &&
322
+ active == o.active &&
323
+ discount_percent == o.discount_percent &&
324
+ duration_cycles == o.duration_cycles &&
325
+ free_months == o.free_months &&
326
+ pause_cycles == o.pause_cycles &&
327
+ credit_minor == o.credit_minor &&
328
+ currency == o.currency &&
329
+ target_product_id == o.target_product_id &&
330
+ target_price_id == o.target_price_id
331
+ end
332
+
333
+ # @see the `==` method
334
+ # @param [Object] Object to be compared
335
+ def eql?(o)
336
+ self == o
337
+ end
338
+
339
+ # Calculates hash code according to all attributes.
340
+ # @return [Integer] Hash code
341
+ def hash
342
+ [id, key, label, type, active, discount_percent, duration_cycles, free_months, pause_cycles, credit_minor, currency, target_product_id, target_price_id].hash
343
+ end
344
+
345
+ # Builds the object from hash
346
+ # @param [Hash] attributes Model attributes in the form of hash
347
+ # @return [Object] Returns the model itself
348
+ def self.build_from_hash(attributes)
349
+ return nil unless attributes.is_a?(Hash)
350
+ attributes = attributes.transform_keys(&:to_sym)
351
+ # include attributes inherited from allOf parents (the nearest declaration wins)
352
+ map = acceptable_attribute_map
353
+ transformed_hash = {}
354
+ acceptable_openapi_types.each_pair do |key, type|
355
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
356
+ transformed_hash["#{key}"] = nil
357
+ elsif type =~ /\AArray<(.*)>/i
358
+ # check to ensure the input is an array given that the attribute
359
+ # is documented as an array but the input is not
360
+ if attributes[map[key]].is_a?(Array)
361
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
362
+ end
363
+ elsif !attributes[map[key]].nil?
364
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
365
+ end
366
+ end
367
+ new(transformed_hash)
368
+ end
369
+
370
+ # Returns the object in the form of hash
371
+ # @return [Hash] Returns the object in the form of hash
372
+ def to_hash
373
+ hash = {}
374
+ # include attributes inherited from allOf parents (the nearest declaration wins)
375
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
376
+ value = self.send(attr)
377
+ if value.nil?
378
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
379
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
380
+ end
381
+
382
+ hash[param] = _to_hash(value)
383
+ end
384
+ hash
385
+ end
386
+
387
+ end
388
+
389
+ end