pnap_billing_api 2.1.2 → 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 +82 -41
@@ -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
  # Details of the bandwidth associated with this rated usage record.
18
- class BandwidthDetails
18
+ class BandwidthDetails < ApiModelBase
19
19
  # The amount of GB consumed in ingress (IN).
20
20
  attr_accessor :ingress_gb
21
21
 
@@ -60,9 +60,14 @@ module BillingApi
60
60
  }
61
61
  end
62
62
 
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
63
68
  # Returns all the JSON keys this model knows about
64
69
  def self.acceptable_attributes
65
- attribute_map.values
70
+ acceptable_attribute_map.values
66
71
  end
67
72
 
68
73
  # Attribute type mapping.
@@ -89,9 +94,10 @@ module BillingApi
89
94
  end
90
95
 
91
96
  # check to see if the attribute exists and convert string to symbol for hash key
97
+ acceptable_attribute_map = self.class.acceptable_attribute_map
92
98
  attributes = attributes.each_with_object({}) { |(k, v), h|
93
- if (!self.class.attribute_map.key?(k.to_sym))
94
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::BandwidthDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ if (!acceptable_attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::BandwidthDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
95
101
  end
96
102
  h[k.to_sym] = v
97
103
  }
@@ -144,6 +150,26 @@ module BillingApi
144
150
  true
145
151
  end
146
152
 
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] ingress_gb Value to be assigned
155
+ def ingress_gb=(ingress_gb)
156
+ if ingress_gb.nil?
157
+ fail ArgumentError, 'ingress_gb cannot be nil'
158
+ end
159
+
160
+ @ingress_gb = ingress_gb
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] egress_gb Value to be assigned
165
+ def egress_gb=(egress_gb)
166
+ if egress_gb.nil?
167
+ fail ArgumentError, 'egress_gb cannot be nil'
168
+ end
169
+
170
+ @egress_gb = egress_gb
171
+ end
172
+
147
173
  # Custom attribute writer method checking allowed values (enum).
148
174
  # @param [Object] package_unit Object to be assigned
149
175
  def package_unit=(package_unit)
@@ -200,61 +226,6 @@ module BillingApi
200
226
  new(transformed_hash)
201
227
  end
202
228
 
203
- # Deserializes the data based on type
204
- # @param string type Data type
205
- # @param string value Value to be deserialized
206
- # @return [Object] Deserialized data
207
- def self._deserialize(type, value)
208
- case type.to_sym
209
- when :Time
210
- Time.parse(value)
211
- when :Date
212
- Date.parse(value)
213
- when :String
214
- value.to_s
215
- when :Integer
216
- value.to_i
217
- when :Float
218
- value.to_f
219
- when :Boolean
220
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
- true
222
- else
223
- false
224
- end
225
- when :Object
226
- # generic object (usually a Hash), return directly
227
- value
228
- when /\AArray<(?<inner_type>.+)>\z/
229
- inner_type = Regexp.last_match[:inner_type]
230
- value.map { |v| _deserialize(inner_type, v) }
231
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
- k_type = Regexp.last_match[:k_type]
233
- v_type = Regexp.last_match[:v_type]
234
- {}.tap do |hash|
235
- value.each do |k, v|
236
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
- end
238
- end
239
- else # model
240
- # models (e.g. Pet) or oneOf
241
- klass = BillingApi.const_get(type)
242
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
243
- end
244
- end
245
-
246
- # Returns the string representation of the object
247
- # @return [String] String presentation of the object
248
- def to_s
249
- to_hash.to_s
250
- end
251
-
252
- # to_body is an alias to to_hash (backward compatibility)
253
- # @return [Hash] Returns the object in the form of hash
254
- def to_body
255
- to_hash
256
- end
257
-
258
229
  # Returns the object in the form of hash
259
230
  # @return [Hash] Returns the object in the form of hash
260
231
  def to_hash
@@ -271,24 +242,6 @@ module BillingApi
271
242
  hash
272
243
  end
273
244
 
274
- # Outputs non-array value in the form of hash
275
- # For object, use to_hash. Otherwise, just return the value
276
- # @param [Object] value Any valid value
277
- # @return [Hash] Returns the value in the form of hash
278
- def _to_hash(value)
279
- if value.is_a?(Array)
280
- value.compact.map { |v| _to_hash(v) }
281
- elsif value.is_a?(Hash)
282
- {}.tap do |hash|
283
- value.each { |k, v| hash[k] = _to_hash(v) }
284
- end
285
- elsif value.respond_to? :to_hash
286
- value.to_hash
287
- else
288
- value
289
- end
290
- end
291
-
292
245
  end
293
246
 
294
247
  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
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module BillingApi
17
- class BandwidthRecord
17
+ class BandwidthRecord < 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' => :'BandwidthDetails'
@@ -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::BandwidthRecord`. 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::BandwidthRecord`. 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
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BillingApi
17
17
  # Billing configuration details.
18
- class ConfigurationDetails
18
+ class ConfigurationDetails < ApiModelBase
19
19
  attr_accessor :threshold_configuration
20
20
 
21
21
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -25,9 +25,14 @@ module BillingApi
25
25
  }
26
26
  end
27
27
 
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
28
33
  # Returns all the JSON keys this model knows about
29
34
  def self.acceptable_attributes
30
- attribute_map.values
35
+ acceptable_attribute_map.values
31
36
  end
32
37
 
33
38
  # Attribute type mapping.
@@ -51,9 +56,10 @@ module BillingApi
51
56
  end
52
57
 
53
58
  # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
54
60
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
- if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
57
63
  end
58
64
  h[k.to_sym] = v
59
65
  }
@@ -121,61 +127,6 @@ module BillingApi
121
127
  new(transformed_hash)
122
128
  end
123
129
 
124
- # Deserializes the data based on type
125
- # @param string type Data type
126
- # @param string value Value to be deserialized
127
- # @return [Object] Deserialized data
128
- def self._deserialize(type, value)
129
- case type.to_sym
130
- when :Time
131
- Time.parse(value)
132
- when :Date
133
- Date.parse(value)
134
- when :String
135
- value.to_s
136
- when :Integer
137
- value.to_i
138
- when :Float
139
- value.to_f
140
- when :Boolean
141
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
- true
143
- else
144
- false
145
- end
146
- when :Object
147
- # generic object (usually a Hash), return directly
148
- value
149
- when /\AArray<(?<inner_type>.+)>\z/
150
- inner_type = Regexp.last_match[:inner_type]
151
- value.map { |v| _deserialize(inner_type, v) }
152
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
- k_type = Regexp.last_match[:k_type]
154
- v_type = Regexp.last_match[:v_type]
155
- {}.tap do |hash|
156
- value.each do |k, v|
157
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
- end
159
- end
160
- else # model
161
- # models (e.g. Pet) or oneOf
162
- klass = BillingApi.const_get(type)
163
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
- end
165
- end
166
-
167
- # Returns the string representation of the object
168
- # @return [String] String presentation of the object
169
- def to_s
170
- to_hash.to_s
171
- end
172
-
173
- # to_body is an alias to to_hash (backward compatibility)
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_body
176
- to_hash
177
- end
178
-
179
130
  # Returns the object in the form of hash
180
131
  # @return [Hash] Returns the object in the form of hash
181
132
  def to_hash
@@ -192,24 +143,6 @@ module BillingApi
192
143
  hash
193
144
  end
194
145
 
195
- # Outputs non-array value in the form of hash
196
- # For object, use to_hash. Otherwise, just return the value
197
- # @param [Object] value Any valid value
198
- # @return [Hash] Returns the value in the form of hash
199
- def _to_hash(value)
200
- if value.is_a?(Array)
201
- value.compact.map { |v| _to_hash(v) }
202
- elsif value.is_a?(Hash)
203
- {}.tap do |hash|
204
- value.each { |k, v| hash[k] = _to_hash(v) }
205
- end
206
- elsif value.respond_to? :to_hash
207
- value.to_hash
208
- else
209
- value
210
- end
211
- end
212
-
213
146
  end
214
147
 
215
148
  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
 
@@ -38,8 +38,7 @@ module BillingApi
38
38
  openapi_one_of.each do |klass|
39
39
  begin
40
40
  next if klass == :AnyType # "nullable: true"
41
- typed_data = find_and_cast_into_type(klass, data)
42
- return typed_data if typed_data
41
+ return find_and_cast_into_type(klass, data)
43
42
  rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
43
  end
45
44
  end
@@ -65,7 +64,7 @@ module BillingApi
65
64
  when 'Time'
66
65
  return Time.parse(data)
67
66
  when 'Date'
68
- return Date.parse(data)
67
+ return Date.iso8601(data)
69
68
  when 'String'
70
69
  return data if data.instance_of?(String)
71
70
  when 'Object' # "type: object"
@@ -88,9 +87,9 @@ module BillingApi
88
87
  return model if model
89
88
  else
90
89
  # raise if data contains keys that are not known to the model
91
- raise unless (data.keys - const.acceptable_attributes).empty?
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
91
  model = const.build_from_hash(data)
93
- return model if model && model.valid?
92
+ return model if model
94
93
  end
95
94
  end
96
95
  end
@@ -101,5 +100,4 @@ module BillingApi
101
100
  end
102
101
  end
103
102
  end
104
-
105
103
  end