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