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