pnap_billing_api 2.1.1 → 3.0.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/VERSION +1 -1
  4. data/docs/BandwidthRecord.md +4 -2
  5. data/docs/LocationAvailabilityDetail.md +1 -1
  6. data/docs/OperatingSystemRecord.md +4 -2
  7. data/docs/PackageDetails.md +20 -0
  8. data/docs/PackageQuantity.md +20 -0
  9. data/docs/PricingPlan.md +3 -1
  10. data/docs/ProductAvailabilityApi.md +4 -4
  11. data/docs/ProductLocationEnum.md +15 -0
  12. data/docs/PublicSubnetRecord.md +4 -2
  13. data/docs/Quantity.md +20 -0
  14. data/docs/QuantityUnitEnum.md +15 -0
  15. data/docs/RatedUsageRecord.md +4 -2
  16. data/docs/Reservation.md +10 -2
  17. data/docs/ReservationDetails.md +20 -0
  18. data/docs/ReservationRequest.md +3 -1
  19. data/docs/ReservationStateEnum.md +15 -0
  20. data/docs/ReservationTerm.md +20 -0
  21. data/docs/ReservationsApi.md +2 -2
  22. data/docs/ServerRecord.md +4 -2
  23. data/docs/StorageDetails.md +5 -5
  24. data/docs/StorageRecord.md +4 -2
  25. data/docs/Utilization.md +20 -0
  26. data/lib/pnap_billing_api/api/billing_configurations_api.rb +2 -2
  27. data/lib/pnap_billing_api/api/product_availability_api.rb +14 -6
  28. data/lib/pnap_billing_api/api/products_api.rb +2 -2
  29. data/lib/pnap_billing_api/api/rated_usage_api.rb +3 -3
  30. data/lib/pnap_billing_api/api/reservations_api.rb +7 -7
  31. data/lib/pnap_billing_api/api_client.rb +17 -14
  32. data/lib/pnap_billing_api/api_error.rb +1 -1
  33. data/lib/pnap_billing_api/api_model_base.rb +88 -0
  34. data/lib/pnap_billing_api/configuration.rb +11 -1
  35. data/lib/pnap_billing_api/models/applicable_discount_details.rb +41 -78
  36. data/lib/pnap_billing_api/models/applicable_discounts.rb +11 -78
  37. data/lib/pnap_billing_api/models/bandwidth_details.rb +31 -78
  38. data/lib/pnap_billing_api/models/bandwidth_record.rb +151 -93
  39. data/lib/pnap_billing_api/models/configuration_details.rb +11 -78
  40. data/lib/pnap_billing_api/models/credit_details.rb +5 -7
  41. data/lib/pnap_billing_api/models/credit_details_base.rb +31 -78
  42. data/lib/pnap_billing_api/models/credit_type_enum.rb +1 -1
  43. data/lib/pnap_billing_api/models/discount_details.rb +41 -78
  44. data/lib/pnap_billing_api/models/discount_type_enum.rb +1 -1
  45. data/lib/pnap_billing_api/models/error.rb +21 -78
  46. data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +11 -78
  47. data/lib/pnap_billing_api/models/location_availability_detail.rb +52 -79
  48. data/lib/pnap_billing_api/models/location_enum.rb +1 -1
  49. data/lib/pnap_billing_api/models/operating_system_details.rb +31 -78
  50. data/lib/pnap_billing_api/models/operating_system_record.rb +151 -93
  51. data/lib/pnap_billing_api/models/package_details.rb +179 -0
  52. data/lib/pnap_billing_api/models/package_quantity.rb +193 -0
  53. data/lib/pnap_billing_api/models/package_unit_enum.rb +1 -1
  54. data/lib/pnap_billing_api/models/price_unit_enum.rb +3 -2
  55. data/lib/pnap_billing_api/models/pricing_plan.rb +56 -84
  56. data/lib/pnap_billing_api/models/product.rb +31 -78
  57. data/lib/pnap_billing_api/models/product_availability.rb +41 -78
  58. data/lib/pnap_billing_api/models/product_category_enum.rb +1 -1
  59. data/lib/pnap_billing_api/models/product_location_enum.rb +44 -0
  60. data/lib/pnap_billing_api/models/products_get200_response_inner.rb +1 -2
  61. data/lib/pnap_billing_api/models/promo_credit_details.rb +51 -78
  62. data/lib/pnap_billing_api/models/public_subnet_details.rb +31 -78
  63. data/lib/pnap_billing_api/models/public_subnet_record.rb +151 -93
  64. data/lib/pnap_billing_api/models/quantity.rb +223 -0
  65. data/lib/pnap_billing_api/models/quantity_unit_enum.rb +40 -0
  66. data/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb +1 -2
  67. data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +1 -1
  68. data/lib/pnap_billing_api/models/rated_usage_record.rb +141 -93
  69. data/lib/pnap_billing_api/models/reservation.rb +186 -83
  70. data/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb +11 -78
  71. data/lib/pnap_billing_api/models/reservation_details.rb +158 -0
  72. data/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb +1 -1
  73. data/lib/pnap_billing_api/models/reservation_model_enum.rb +3 -2
  74. data/lib/pnap_billing_api/models/reservation_product_category_enum.rb +3 -2
  75. data/lib/pnap_billing_api/models/reservation_request.rb +51 -82
  76. data/lib/pnap_billing_api/models/reservation_state_enum.rb +44 -0
  77. data/lib/pnap_billing_api/models/reservation_term.rb +214 -0
  78. data/lib/pnap_billing_api/models/server_details.rb +31 -78
  79. data/lib/pnap_billing_api/models/server_product.rb +41 -78
  80. data/lib/pnap_billing_api/models/server_product_metadata.rb +81 -78
  81. data/lib/pnap_billing_api/models/server_record.rb +151 -93
  82. data/lib/pnap_billing_api/models/storage_details.rb +21 -113
  83. data/lib/pnap_billing_api/models/storage_record.rb +151 -93
  84. data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +1 -1
  85. data/lib/pnap_billing_api/models/system_credit_details.rb +41 -78
  86. data/lib/pnap_billing_api/models/threshold_configuration_details.rb +21 -78
  87. data/lib/pnap_billing_api/models/utilization.rb +208 -0
  88. data/lib/pnap_billing_api/version.rb +1 -2
  89. data/lib/pnap_billing_api.rb +11 -1
  90. data/pnap_billing_api.gemspec +6 -6
  91. data/spec/api/billing_configurations_api_spec.rb +1 -1
  92. data/spec/api/product_availability_api_spec.rb +3 -3
  93. data/spec/api/products_api_spec.rb +1 -1
  94. data/spec/api/rated_usage_api_spec.rb +1 -1
  95. data/spec/api/reservations_api_spec.rb +1 -1
  96. data/spec/models/applicable_discount_details_spec.rb +2 -2
  97. data/spec/models/applicable_discounts_spec.rb +2 -2
  98. data/spec/models/bandwidth_details_spec.rb +2 -2
  99. data/spec/models/bandwidth_record_spec.rb +8 -2
  100. data/spec/models/configuration_details_spec.rb +2 -2
  101. data/spec/models/credit_details_base_spec.rb +2 -2
  102. data/spec/models/credit_details_spec.rb +1 -1
  103. data/spec/models/credit_type_enum_spec.rb +2 -2
  104. data/spec/models/discount_details_spec.rb +2 -2
  105. data/spec/models/discount_type_enum_spec.rb +2 -2
  106. data/spec/models/error_spec.rb +2 -2
  107. data/spec/models/gpu_configuration_metadata_spec.rb +2 -2
  108. data/spec/models/location_availability_detail_spec.rb +2 -2
  109. data/spec/models/location_enum_spec.rb +2 -2
  110. data/spec/models/operating_system_details_spec.rb +2 -2
  111. data/spec/models/operating_system_record_spec.rb +8 -2
  112. data/spec/models/package_details_spec.rb +42 -0
  113. data/spec/models/package_quantity_spec.rb +42 -0
  114. data/spec/models/package_unit_enum_spec.rb +2 -2
  115. data/spec/models/price_unit_enum_spec.rb +2 -2
  116. data/spec/models/pricing_plan_spec.rb +9 -3
  117. data/spec/models/product_availability_spec.rb +2 -2
  118. data/spec/models/product_category_enum_spec.rb +2 -2
  119. data/spec/models/product_location_enum_spec.rb +30 -0
  120. data/spec/models/product_spec.rb +2 -2
  121. data/spec/models/products_get200_response_inner_spec.rb +1 -1
  122. data/spec/models/promo_credit_details_spec.rb +2 -2
  123. data/spec/models/public_subnet_details_spec.rb +2 -2
  124. data/spec/models/public_subnet_record_spec.rb +8 -2
  125. data/spec/models/quantity_spec.rb +42 -0
  126. data/spec/models/quantity_unit_enum_spec.rb +30 -0
  127. data/spec/models/rated_usage_get200_response_inner_spec.rb +1 -1
  128. data/spec/models/rated_usage_product_category_enum_spec.rb +2 -2
  129. data/spec/models/rated_usage_record_spec.rb +8 -2
  130. data/spec/models/reservation_auto_renew_disable_request_spec.rb +2 -2
  131. data/spec/models/reservation_details_spec.rb +42 -0
  132. data/spec/models/reservation_invoicing_model_enum_spec.rb +2 -2
  133. data/spec/models/reservation_model_enum_spec.rb +2 -2
  134. data/spec/models/reservation_product_category_enum_spec.rb +2 -2
  135. data/spec/models/reservation_request_spec.rb +8 -2
  136. data/spec/models/reservation_spec.rb +26 -2
  137. data/spec/models/reservation_state_enum_spec.rb +30 -0
  138. data/spec/models/reservation_term_spec.rb +42 -0
  139. data/spec/models/server_details_spec.rb +2 -2
  140. data/spec/models/server_product_metadata_spec.rb +2 -2
  141. data/spec/models/server_product_spec.rb +2 -2
  142. data/spec/models/server_record_spec.rb +8 -2
  143. data/spec/models/storage_details_spec.rb +2 -2
  144. data/spec/models/storage_record_spec.rb +8 -2
  145. data/spec/models/system_credit_cause_enum_spec.rb +2 -2
  146. data/spec/models/system_credit_details_spec.rb +2 -2
  147. data/spec/models/threshold_configuration_details_spec.rb +2 -2
  148. data/spec/models/utilization_spec.rb +42 -0
  149. data/spec/spec_helper.rb +1 -1
  150. metadata +84 -43
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module BillingApi
17
- class StorageRecord
17
+ class StorageRecord < ApiModelBase
18
18
  # The unique identifier of the rated usage record.
19
19
  attr_accessor :id
20
20
 
@@ -67,6 +67,8 @@ module BillingApi
67
67
  # Reservation id associated with this rated usage record.
68
68
  attr_accessor :reservation_id
69
69
 
70
+ attr_accessor :reservation_details
71
+
70
72
  attr_accessor :discount_details
71
73
 
72
74
  attr_accessor :credit_details
@@ -116,15 +118,21 @@ module BillingApi
116
118
  :'usage_session_id' => :'usageSessionId',
117
119
  :'correlation_id' => :'correlationId',
118
120
  :'reservation_id' => :'reservationId',
121
+ :'reservation_details' => :'reservationDetails',
119
122
  :'discount_details' => :'discountDetails',
120
123
  :'credit_details' => :'creditDetails',
121
124
  :'metadata' => :'metadata'
122
125
  }
123
126
  end
124
127
 
128
+ # Returns attribute mapping this model knows about
129
+ def self.acceptable_attribute_map
130
+ attribute_map
131
+ end
132
+
125
133
  # Returns all the JSON keys this model knows about
126
134
  def self.acceptable_attributes
127
- attribute_map.values
135
+ acceptable_attribute_map.values
128
136
  end
129
137
 
130
138
  # Attribute type mapping.
@@ -148,6 +156,7 @@ module BillingApi
148
156
  :'usage_session_id' => :'String',
149
157
  :'correlation_id' => :'String',
150
158
  :'reservation_id' => :'String',
159
+ :'reservation_details' => :'ReservationDetails',
151
160
  :'discount_details' => :'ApplicableDiscountDetails',
152
161
  :'credit_details' => :'Array<CreditDetails>',
153
162
  :'metadata' => :'StorageDetails'
@@ -175,9 +184,10 @@ module BillingApi
175
184
  end
176
185
 
177
186
  # check to see if the attribute exists and convert string to symbol for hash key
187
+ acceptable_attribute_map = self.class.acceptable_attribute_map
178
188
  attributes = attributes.each_with_object({}) { |(k, v), h|
179
- if (!self.class.attribute_map.key?(k.to_sym))
180
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::StorageRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
189
+ if (!acceptable_attribute_map.key?(k.to_sym))
190
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::StorageRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
181
191
  end
182
192
  h[k.to_sym] = v
183
193
  }
@@ -268,20 +278,20 @@ module BillingApi
268
278
 
269
279
  if attributes.key?(:'usage_session_id')
270
280
  self.usage_session_id = attributes[:'usage_session_id']
271
- else
272
- self.usage_session_id = nil
273
281
  end
274
282
 
275
283
  if attributes.key?(:'correlation_id')
276
284
  self.correlation_id = attributes[:'correlation_id']
277
- else
278
- self.correlation_id = nil
279
285
  end
280
286
 
281
287
  if attributes.key?(:'reservation_id')
282
288
  self.reservation_id = attributes[:'reservation_id']
283
289
  end
284
290
 
291
+ if attributes.key?(:'reservation_details')
292
+ self.reservation_details = attributes[:'reservation_details']
293
+ end
294
+
285
295
  if attributes.key?(:'discount_details')
286
296
  self.discount_details = attributes[:'discount_details']
287
297
  end
@@ -352,14 +362,6 @@ module BillingApi
352
362
  invalid_properties.push('invalid value for "active", active cannot be nil.')
353
363
  end
354
364
 
355
- if @usage_session_id.nil?
356
- invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.')
357
- end
358
-
359
- if @correlation_id.nil?
360
- invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.')
361
- end
362
-
363
365
  if @metadata.nil?
364
366
  invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
365
367
  end
@@ -383,12 +385,140 @@ module BillingApi
383
385
  return false if @unit_price_description.nil?
384
386
  return false if @quantity.nil?
385
387
  return false if @active.nil?
386
- return false if @usage_session_id.nil?
387
- return false if @correlation_id.nil?
388
388
  return false if @metadata.nil?
389
389
  true
390
390
  end
391
391
 
392
+ # Custom attribute writer method with validation
393
+ # @param [Object] id Value to be assigned
394
+ def id=(id)
395
+ if id.nil?
396
+ fail ArgumentError, 'id cannot be nil'
397
+ end
398
+
399
+ @id = id
400
+ end
401
+
402
+ # Custom attribute writer method with validation
403
+ # @param [Object] product_category Value to be assigned
404
+ def product_category=(product_category)
405
+ if product_category.nil?
406
+ fail ArgumentError, 'product_category cannot be nil'
407
+ end
408
+
409
+ @product_category = product_category
410
+ end
411
+
412
+ # Custom attribute writer method with validation
413
+ # @param [Object] product_code Value to be assigned
414
+ def product_code=(product_code)
415
+ if product_code.nil?
416
+ fail ArgumentError, 'product_code cannot be nil'
417
+ end
418
+
419
+ @product_code = product_code
420
+ end
421
+
422
+ # Custom attribute writer method with validation
423
+ # @param [Object] location Value to be assigned
424
+ def location=(location)
425
+ if location.nil?
426
+ fail ArgumentError, 'location cannot be nil'
427
+ end
428
+
429
+ @location = location
430
+ end
431
+
432
+ # Custom attribute writer method with validation
433
+ # @param [Object] start_date_time Value to be assigned
434
+ def start_date_time=(start_date_time)
435
+ if start_date_time.nil?
436
+ fail ArgumentError, 'start_date_time cannot be nil'
437
+ end
438
+
439
+ @start_date_time = start_date_time
440
+ end
441
+
442
+ # Custom attribute writer method with validation
443
+ # @param [Object] end_date_time Value to be assigned
444
+ def end_date_time=(end_date_time)
445
+ if end_date_time.nil?
446
+ fail ArgumentError, 'end_date_time cannot be nil'
447
+ end
448
+
449
+ @end_date_time = end_date_time
450
+ end
451
+
452
+ # Custom attribute writer method with validation
453
+ # @param [Object] cost Value to be assigned
454
+ def cost=(cost)
455
+ if cost.nil?
456
+ fail ArgumentError, 'cost cannot be nil'
457
+ end
458
+
459
+ @cost = cost
460
+ end
461
+
462
+ # Custom attribute writer method with validation
463
+ # @param [Object] price_model Value to be assigned
464
+ def price_model=(price_model)
465
+ if price_model.nil?
466
+ fail ArgumentError, 'price_model cannot be nil'
467
+ end
468
+
469
+ @price_model = price_model
470
+ end
471
+
472
+ # Custom attribute writer method with validation
473
+ # @param [Object] unit_price Value to be assigned
474
+ def unit_price=(unit_price)
475
+ if unit_price.nil?
476
+ fail ArgumentError, 'unit_price cannot be nil'
477
+ end
478
+
479
+ @unit_price = unit_price
480
+ end
481
+
482
+ # Custom attribute writer method with validation
483
+ # @param [Object] unit_price_description Value to be assigned
484
+ def unit_price_description=(unit_price_description)
485
+ if unit_price_description.nil?
486
+ fail ArgumentError, 'unit_price_description cannot be nil'
487
+ end
488
+
489
+ @unit_price_description = unit_price_description
490
+ end
491
+
492
+ # Custom attribute writer method with validation
493
+ # @param [Object] quantity Value to be assigned
494
+ def quantity=(quantity)
495
+ if quantity.nil?
496
+ fail ArgumentError, 'quantity cannot be nil'
497
+ end
498
+
499
+ @quantity = quantity
500
+ end
501
+
502
+ # Custom attribute writer method with validation
503
+ # @param [Object] active Value to be assigned
504
+ def active=(active)
505
+ if active.nil?
506
+ fail ArgumentError, 'active cannot be nil'
507
+ end
508
+
509
+ @active = active
510
+ end
511
+
512
+ # Custom attribute writer method with validation
513
+ # @param [Object] metadata Value to be assigned
514
+ def metadata=(metadata)
515
+ if metadata.nil?
516
+ fail ArgumentError, 'metadata cannot be nil'
517
+ end
518
+
519
+ @metadata = metadata
520
+ end
521
+
392
522
  # Checks equality by comparing each attribute.
393
523
  # @param [Object] Object to be compared
394
524
  def ==(o)
@@ -412,6 +542,7 @@ module BillingApi
412
542
  usage_session_id == o.usage_session_id &&
413
543
  correlation_id == o.correlation_id &&
414
544
  reservation_id == o.reservation_id &&
545
+ reservation_details == o.reservation_details &&
415
546
  discount_details == o.discount_details &&
416
547
  credit_details == o.credit_details &&
417
548
  metadata == o.metadata
@@ -426,7 +557,7 @@ module BillingApi
426
557
  # Calculates hash code according to all attributes.
427
558
  # @return [Integer] Hash code
428
559
  def hash
429
- [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details, metadata].hash
560
+ [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details, metadata].hash
430
561
  end
431
562
 
432
563
  # Builds the object from hash
@@ -452,61 +583,6 @@ module BillingApi
452
583
  new(transformed_hash)
453
584
  end
454
585
 
455
- # Deserializes the data based on type
456
- # @param string type Data type
457
- # @param string value Value to be deserialized
458
- # @return [Object] Deserialized data
459
- def self._deserialize(type, value)
460
- case type.to_sym
461
- when :Time
462
- Time.parse(value)
463
- when :Date
464
- Date.parse(value)
465
- when :String
466
- value.to_s
467
- when :Integer
468
- value.to_i
469
- when :Float
470
- value.to_f
471
- when :Boolean
472
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
473
- true
474
- else
475
- false
476
- end
477
- when :Object
478
- # generic object (usually a Hash), return directly
479
- value
480
- when /\AArray<(?<inner_type>.+)>\z/
481
- inner_type = Regexp.last_match[:inner_type]
482
- value.map { |v| _deserialize(inner_type, v) }
483
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
484
- k_type = Regexp.last_match[:k_type]
485
- v_type = Regexp.last_match[:v_type]
486
- {}.tap do |hash|
487
- value.each do |k, v|
488
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
489
- end
490
- end
491
- else # model
492
- # models (e.g. Pet) or oneOf
493
- klass = BillingApi.const_get(type)
494
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
495
- end
496
- end
497
-
498
- # Returns the string representation of the object
499
- # @return [String] String presentation of the object
500
- def to_s
501
- to_hash.to_s
502
- end
503
-
504
- # to_body is an alias to to_hash (backward compatibility)
505
- # @return [Hash] Returns the object in the form of hash
506
- def to_body
507
- to_hash
508
- end
509
-
510
586
  # Returns the object in the form of hash
511
587
  # @return [Hash] Returns the object in the form of hash
512
588
  def to_hash
@@ -523,24 +599,6 @@ module BillingApi
523
599
  hash
524
600
  end
525
601
 
526
- # Outputs non-array value in the form of hash
527
- # For object, use to_hash. Otherwise, just return the value
528
- # @param [Object] value Any valid value
529
- # @return [Hash] Returns the value in the form of hash
530
- def _to_hash(value)
531
- if value.is_a?(Array)
532
- value.compact.map { |v| _to_hash(v) }
533
- elsif value.is_a?(Hash)
534
- {}.tap do |hash|
535
- value.each { |k, v| hash[k] = _to_hash(v) }
536
- end
537
- elsif value.respond_to? :to_hash
538
- value.to_hash
539
- else
540
- value
541
- end
542
- end
543
-
544
602
  end
545
603
 
546
604
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module BillingApi
17
- class SystemCreditDetails
17
+ class SystemCreditDetails < ApiModelBase
18
18
  # Amount applied.
19
19
  attr_accessor :applied_amount
20
20
 
@@ -53,9 +53,14 @@ module BillingApi
53
53
  }
54
54
  end
55
55
 
56
+ # Returns attribute mapping this model knows about
57
+ def self.acceptable_attribute_map
58
+ attribute_map
59
+ end
60
+
56
61
  # Returns all the JSON keys this model knows about
57
62
  def self.acceptable_attributes
58
- attribute_map.values
63
+ acceptable_attribute_map.values
59
64
  end
60
65
 
61
66
  # Attribute type mapping.
@@ -88,9 +93,10 @@ module BillingApi
88
93
  end
89
94
 
90
95
  # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
97
  attributes = attributes.each_with_object({}) { |(k, v), h|
92
- if (!self.class.attribute_map.key?(k.to_sym))
93
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::SystemCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::SystemCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
100
  end
95
101
  h[k.to_sym] = v
96
102
  }
@@ -144,6 +150,36 @@ module BillingApi
144
150
  true
145
151
  end
146
152
 
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] applied_amount Value to be assigned
155
+ def applied_amount=(applied_amount)
156
+ if applied_amount.nil?
157
+ fail ArgumentError, 'applied_amount cannot be nil'
158
+ end
159
+
160
+ @applied_amount = applied_amount
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] type Value to be assigned
165
+ def type=(type)
166
+ if type.nil?
167
+ fail ArgumentError, 'type cannot be nil'
168
+ end
169
+
170
+ @type = type
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] cause Value to be assigned
175
+ def cause=(cause)
176
+ if cause.nil?
177
+ fail ArgumentError, 'cause cannot be nil'
178
+ end
179
+
180
+ @cause = cause
181
+ end
182
+
147
183
  # Checks equality by comparing each attribute.
148
184
  # @param [Object] Object to be compared
149
185
  def ==(o)
@@ -189,61 +225,6 @@ module BillingApi
189
225
  new(transformed_hash)
190
226
  end
191
227
 
192
- # Deserializes the data based on type
193
- # @param string type Data type
194
- # @param string value Value to be deserialized
195
- # @return [Object] Deserialized data
196
- def self._deserialize(type, value)
197
- case type.to_sym
198
- when :Time
199
- Time.parse(value)
200
- when :Date
201
- Date.parse(value)
202
- when :String
203
- value.to_s
204
- when :Integer
205
- value.to_i
206
- when :Float
207
- value.to_f
208
- when :Boolean
209
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
- true
211
- else
212
- false
213
- end
214
- when :Object
215
- # generic object (usually a Hash), return directly
216
- value
217
- when /\AArray<(?<inner_type>.+)>\z/
218
- inner_type = Regexp.last_match[:inner_type]
219
- value.map { |v| _deserialize(inner_type, v) }
220
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
- k_type = Regexp.last_match[:k_type]
222
- v_type = Regexp.last_match[:v_type]
223
- {}.tap do |hash|
224
- value.each do |k, v|
225
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
- end
227
- end
228
- else # model
229
- # models (e.g. Pet) or oneOf
230
- klass = BillingApi.const_get(type)
231
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
- end
233
- end
234
-
235
- # Returns the string representation of the object
236
- # @return [String] String presentation of the object
237
- def to_s
238
- to_hash.to_s
239
- end
240
-
241
- # to_body is an alias to to_hash (backward compatibility)
242
- # @return [Hash] Returns the object in the form of hash
243
- def to_body
244
- to_hash
245
- end
246
-
247
228
  # Returns the object in the form of hash
248
229
  # @return [Hash] Returns the object in the form of hash
249
230
  def to_hash
@@ -260,24 +241,6 @@ module BillingApi
260
241
  hash
261
242
  end
262
243
 
263
- # Outputs non-array value in the form of hash
264
- # For object, use to_hash. Otherwise, just return the value
265
- # @param [Object] value Any valid value
266
- # @return [Hash] Returns the value in the form of hash
267
- def _to_hash(value)
268
- if value.is_a?(Array)
269
- value.compact.map { |v| _to_hash(v) }
270
- elsif value.is_a?(Hash)
271
- {}.tap do |hash|
272
- value.each { |k, v| hash[k] = _to_hash(v) }
273
- end
274
- elsif value.respond_to? :to_hash
275
- value.to_hash
276
- else
277
- value
278
- end
279
- end
280
-
281
244
  end
282
245
 
283
246
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BillingApi
17
17
  # Threshold billing configuration.
18
- class ThresholdConfigurationDetails
18
+ class ThresholdConfigurationDetails < ApiModelBase
19
19
  # Threshold billing amount.
20
20
  attr_accessor :threshold_amount
21
21
 
@@ -26,9 +26,14 @@ module BillingApi
26
26
  }
27
27
  end
28
28
 
29
+ # Returns attribute mapping this model knows about
30
+ def self.acceptable_attribute_map
31
+ attribute_map
32
+ end
33
+
29
34
  # Returns all the JSON keys this model knows about
30
35
  def self.acceptable_attributes
31
- attribute_map.values
36
+ acceptable_attribute_map.values
32
37
  end
33
38
 
34
39
  # Attribute type mapping.
@@ -52,9 +57,10 @@ module BillingApi
52
57
  end
53
58
 
54
59
  # check to see if the attribute exists and convert string to symbol for hash key
60
+ acceptable_attribute_map = self.class.acceptable_attribute_map
55
61
  attributes = attributes.each_with_object({}) { |(k, v), h|
56
- if (!self.class.attribute_map.key?(k.to_sym))
57
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ThresholdConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ if (!acceptable_attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ThresholdConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
58
64
  end
59
65
  h[k.to_sym] = v
60
66
  }
@@ -86,6 +92,16 @@ module BillingApi
86
92
  true
87
93
  end
88
94
 
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] threshold_amount Value to be assigned
97
+ def threshold_amount=(threshold_amount)
98
+ if threshold_amount.nil?
99
+ fail ArgumentError, 'threshold_amount cannot be nil'
100
+ end
101
+
102
+ @threshold_amount = threshold_amount
103
+ end
104
+
89
105
  # Checks equality by comparing each attribute.
90
106
  # @param [Object] Object to be compared
91
107
  def ==(o)
@@ -129,61 +145,6 @@ module BillingApi
129
145
  new(transformed_hash)
130
146
  end
131
147
 
132
- # Deserializes the data based on type
133
- # @param string type Data type
134
- # @param string value Value to be deserialized
135
- # @return [Object] Deserialized data
136
- def self._deserialize(type, value)
137
- case type.to_sym
138
- when :Time
139
- Time.parse(value)
140
- when :Date
141
- Date.parse(value)
142
- when :String
143
- value.to_s
144
- when :Integer
145
- value.to_i
146
- when :Float
147
- value.to_f
148
- when :Boolean
149
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
- true
151
- else
152
- false
153
- end
154
- when :Object
155
- # generic object (usually a Hash), return directly
156
- value
157
- when /\AArray<(?<inner_type>.+)>\z/
158
- inner_type = Regexp.last_match[:inner_type]
159
- value.map { |v| _deserialize(inner_type, v) }
160
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
- k_type = Regexp.last_match[:k_type]
162
- v_type = Regexp.last_match[:v_type]
163
- {}.tap do |hash|
164
- value.each do |k, v|
165
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
- end
167
- end
168
- else # model
169
- # models (e.g. Pet) or oneOf
170
- klass = BillingApi.const_get(type)
171
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
- end
173
- end
174
-
175
- # Returns the string representation of the object
176
- # @return [String] String presentation of the object
177
- def to_s
178
- to_hash.to_s
179
- end
180
-
181
- # to_body is an alias to to_hash (backward compatibility)
182
- # @return [Hash] Returns the object in the form of hash
183
- def to_body
184
- to_hash
185
- end
186
-
187
148
  # Returns the object in the form of hash
188
149
  # @return [Hash] Returns the object in the form of hash
189
150
  def to_hash
@@ -200,24 +161,6 @@ module BillingApi
200
161
  hash
201
162
  end
202
163
 
203
- # Outputs non-array value in the form of hash
204
- # For object, use to_hash. Otherwise, just return the value
205
- # @param [Object] value Any valid value
206
- # @return [Hash] Returns the value in the form of hash
207
- def _to_hash(value)
208
- if value.is_a?(Array)
209
- value.compact.map { |v| _to_hash(v) }
210
- elsif value.is_a?(Hash)
211
- {}.tap do |hash|
212
- value.each { |k, v| hash[k] = _to_hash(v) }
213
- end
214
- elsif value.respond_to? :to_hash
215
- value.to_hash
216
- else
217
- value
218
- end
219
- end
220
-
221
164
  end
222
165
 
223
166
  end