pnap_billing_api 2.1.2 → 3.0.1

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
 
@@ -15,11 +15,11 @@ require 'time'
15
15
 
16
16
  module BillingApi
17
17
  # Reservation details
18
- class Reservation
18
+ class Reservation < ApiModelBase
19
19
  # The reservation identifier.
20
20
  attr_accessor :id
21
21
 
22
- # The code identifying the product. This code has significant across all locations.
22
+ # The code identifying the product. The same code is used for this product across all locations.
23
23
  attr_accessor :product_code
24
24
 
25
25
  attr_accessor :product_category
@@ -28,8 +28,14 @@ module BillingApi
28
28
 
29
29
  attr_accessor :reservation_model
30
30
 
31
+ attr_accessor :term
32
+
33
+ attr_accessor :reservation_state
34
+
31
35
  attr_accessor :initial_invoice_model
32
36
 
37
+ attr_accessor :quantity
38
+
33
39
  # The point in time (in UTC) when the reservation starts.
34
40
  attr_accessor :start_date_time
35
41
 
@@ -59,6 +65,8 @@ module BillingApi
59
65
  # Next billing date for Reservation.
60
66
  attr_accessor :next_billing_date
61
67
 
68
+ attr_accessor :utilization
69
+
62
70
  class EnumAttributeValidator
63
71
  attr_reader :datatype
64
72
  attr_reader :allowable_values
@@ -89,7 +97,10 @@ module BillingApi
89
97
  :'product_category' => :'productCategory',
90
98
  :'location' => :'location',
91
99
  :'reservation_model' => :'reservationModel',
100
+ :'term' => :'term',
101
+ :'reservation_state' => :'reservationState',
92
102
  :'initial_invoice_model' => :'initialInvoiceModel',
103
+ :'quantity' => :'quantity',
93
104
  :'start_date_time' => :'startDateTime',
94
105
  :'end_date_time' => :'endDateTime',
95
106
  :'last_renewal_date_time' => :'lastRenewalDateTime',
@@ -99,13 +110,19 @@ module BillingApi
99
110
  :'price' => :'price',
100
111
  :'price_unit' => :'priceUnit',
101
112
  :'assigned_resource_id' => :'assignedResourceId',
102
- :'next_billing_date' => :'nextBillingDate'
113
+ :'next_billing_date' => :'nextBillingDate',
114
+ :'utilization' => :'utilization'
103
115
  }
104
116
  end
105
117
 
118
+ # Returns attribute mapping this model knows about
119
+ def self.acceptable_attribute_map
120
+ attribute_map
121
+ end
122
+
106
123
  # Returns all the JSON keys this model knows about
107
124
  def self.acceptable_attributes
108
- attribute_map.values
125
+ acceptable_attribute_map.values
109
126
  end
110
127
 
111
128
  # Attribute type mapping.
@@ -116,7 +133,10 @@ module BillingApi
116
133
  :'product_category' => :'ReservationProductCategoryEnum',
117
134
  :'location' => :'LocationEnum',
118
135
  :'reservation_model' => :'ReservationModelEnum',
136
+ :'term' => :'ReservationTerm',
137
+ :'reservation_state' => :'ReservationStateEnum',
119
138
  :'initial_invoice_model' => :'ReservationInvoicingModelEnum',
139
+ :'quantity' => :'Quantity',
120
140
  :'start_date_time' => :'Time',
121
141
  :'end_date_time' => :'Time',
122
142
  :'last_renewal_date_time' => :'Time',
@@ -126,7 +146,8 @@ module BillingApi
126
146
  :'price' => :'Float',
127
147
  :'price_unit' => :'PriceUnitEnum',
128
148
  :'assigned_resource_id' => :'String',
129
- :'next_billing_date' => :'Date'
149
+ :'next_billing_date' => :'Date',
150
+ :'utilization' => :'Utilization'
130
151
  }
131
152
  end
132
153
 
@@ -144,9 +165,10 @@ module BillingApi
144
165
  end
145
166
 
146
167
  # check to see if the attribute exists and convert string to symbol for hash key
168
+ acceptable_attribute_map = self.class.acceptable_attribute_map
147
169
  attributes = attributes.each_with_object({}) { |(k, v), h|
148
- if (!self.class.attribute_map.key?(k.to_sym))
149
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Reservation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
170
+ if (!acceptable_attribute_map.key?(k.to_sym))
171
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Reservation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
150
172
  end
151
173
  h[k.to_sym] = v
152
174
  }
@@ -181,10 +203,26 @@ module BillingApi
181
203
  self.reservation_model = nil
182
204
  end
183
205
 
206
+ if attributes.key?(:'term')
207
+ self.term = attributes[:'term']
208
+ end
209
+
210
+ if attributes.key?(:'reservation_state')
211
+ self.reservation_state = attributes[:'reservation_state']
212
+ else
213
+ self.reservation_state = nil
214
+ end
215
+
184
216
  if attributes.key?(:'initial_invoice_model')
185
217
  self.initial_invoice_model = attributes[:'initial_invoice_model']
186
218
  end
187
219
 
220
+ if attributes.key?(:'quantity')
221
+ self.quantity = attributes[:'quantity']
222
+ else
223
+ self.quantity = nil
224
+ end
225
+
188
226
  if attributes.key?(:'start_date_time')
189
227
  self.start_date_time = attributes[:'start_date_time']
190
228
  else
@@ -234,6 +272,10 @@ module BillingApi
234
272
  if attributes.key?(:'next_billing_date')
235
273
  self.next_billing_date = attributes[:'next_billing_date']
236
274
  end
275
+
276
+ if attributes.key?(:'utilization')
277
+ self.utilization = attributes[:'utilization']
278
+ end
237
279
  end
238
280
 
239
281
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -261,6 +303,14 @@ module BillingApi
261
303
  invalid_properties.push('invalid value for "reservation_model", reservation_model cannot be nil.')
262
304
  end
263
305
 
306
+ if @reservation_state.nil?
307
+ invalid_properties.push('invalid value for "reservation_state", reservation_state cannot be nil.')
308
+ end
309
+
310
+ if @quantity.nil?
311
+ invalid_properties.push('invalid value for "quantity", quantity cannot be nil.')
312
+ end
313
+
264
314
  if @start_date_time.nil?
265
315
  invalid_properties.push('invalid value for "start_date_time", start_date_time cannot be nil.')
266
316
  end
@@ -293,6 +343,8 @@ module BillingApi
293
343
  return false if @product_category.nil?
294
344
  return false if @location.nil?
295
345
  return false if @reservation_model.nil?
346
+ return false if @reservation_state.nil?
347
+ return false if @quantity.nil?
296
348
  return false if @start_date_time.nil?
297
349
  return false if @auto_renew.nil?
298
350
  return false if @sku.nil?
@@ -301,6 +353,126 @@ module BillingApi
301
353
  true
302
354
  end
303
355
 
356
+ # Custom attribute writer method with validation
357
+ # @param [Object] id Value to be assigned
358
+ def id=(id)
359
+ if id.nil?
360
+ fail ArgumentError, 'id cannot be nil'
361
+ end
362
+
363
+ @id = id
364
+ end
365
+
366
+ # Custom attribute writer method with validation
367
+ # @param [Object] product_code Value to be assigned
368
+ def product_code=(product_code)
369
+ if product_code.nil?
370
+ fail ArgumentError, 'product_code cannot be nil'
371
+ end
372
+
373
+ @product_code = product_code
374
+ end
375
+
376
+ # Custom attribute writer method with validation
377
+ # @param [Object] product_category Value to be assigned
378
+ def product_category=(product_category)
379
+ if product_category.nil?
380
+ fail ArgumentError, 'product_category cannot be nil'
381
+ end
382
+
383
+ @product_category = product_category
384
+ end
385
+
386
+ # Custom attribute writer method with validation
387
+ # @param [Object] location Value to be assigned
388
+ def location=(location)
389
+ if location.nil?
390
+ fail ArgumentError, 'location cannot be nil'
391
+ end
392
+
393
+ @location = location
394
+ end
395
+
396
+ # Custom attribute writer method with validation
397
+ # @param [Object] reservation_model Value to be assigned
398
+ def reservation_model=(reservation_model)
399
+ if reservation_model.nil?
400
+ fail ArgumentError, 'reservation_model cannot be nil'
401
+ end
402
+
403
+ @reservation_model = reservation_model
404
+ end
405
+
406
+ # Custom attribute writer method with validation
407
+ # @param [Object] reservation_state Value to be assigned
408
+ def reservation_state=(reservation_state)
409
+ if reservation_state.nil?
410
+ fail ArgumentError, 'reservation_state cannot be nil'
411
+ end
412
+
413
+ @reservation_state = reservation_state
414
+ end
415
+
416
+ # Custom attribute writer method with validation
417
+ # @param [Object] quantity Value to be assigned
418
+ def quantity=(quantity)
419
+ if quantity.nil?
420
+ fail ArgumentError, 'quantity cannot be nil'
421
+ end
422
+
423
+ @quantity = quantity
424
+ end
425
+
426
+ # Custom attribute writer method with validation
427
+ # @param [Object] start_date_time Value to be assigned
428
+ def start_date_time=(start_date_time)
429
+ if start_date_time.nil?
430
+ fail ArgumentError, 'start_date_time cannot be nil'
431
+ end
432
+
433
+ @start_date_time = start_date_time
434
+ end
435
+
436
+ # Custom attribute writer method with validation
437
+ # @param [Object] auto_renew Value to be assigned
438
+ def auto_renew=(auto_renew)
439
+ if auto_renew.nil?
440
+ fail ArgumentError, 'auto_renew cannot be nil'
441
+ end
442
+
443
+ @auto_renew = auto_renew
444
+ end
445
+
446
+ # Custom attribute writer method with validation
447
+ # @param [Object] sku Value to be assigned
448
+ def sku=(sku)
449
+ if sku.nil?
450
+ fail ArgumentError, 'sku cannot be nil'
451
+ end
452
+
453
+ @sku = sku
454
+ end
455
+
456
+ # Custom attribute writer method with validation
457
+ # @param [Object] price Value to be assigned
458
+ def price=(price)
459
+ if price.nil?
460
+ fail ArgumentError, 'price cannot be nil'
461
+ end
462
+
463
+ @price = price
464
+ end
465
+
466
+ # Custom attribute writer method with validation
467
+ # @param [Object] price_unit Value to be assigned
468
+ def price_unit=(price_unit)
469
+ if price_unit.nil?
470
+ fail ArgumentError, 'price_unit cannot be nil'
471
+ end
472
+
473
+ @price_unit = price_unit
474
+ end
475
+
304
476
  # Checks equality by comparing each attribute.
305
477
  # @param [Object] Object to be compared
306
478
  def ==(o)
@@ -311,7 +483,10 @@ module BillingApi
311
483
  product_category == o.product_category &&
312
484
  location == o.location &&
313
485
  reservation_model == o.reservation_model &&
486
+ term == o.term &&
487
+ reservation_state == o.reservation_state &&
314
488
  initial_invoice_model == o.initial_invoice_model &&
489
+ quantity == o.quantity &&
315
490
  start_date_time == o.start_date_time &&
316
491
  end_date_time == o.end_date_time &&
317
492
  last_renewal_date_time == o.last_renewal_date_time &&
@@ -321,7 +496,8 @@ module BillingApi
321
496
  price == o.price &&
322
497
  price_unit == o.price_unit &&
323
498
  assigned_resource_id == o.assigned_resource_id &&
324
- next_billing_date == o.next_billing_date
499
+ next_billing_date == o.next_billing_date &&
500
+ utilization == o.utilization
325
501
  end
326
502
 
327
503
  # @see the `==` method
@@ -333,7 +509,7 @@ module BillingApi
333
509
  # Calculates hash code according to all attributes.
334
510
  # @return [Integer] Hash code
335
511
  def hash
336
- [id, product_code, product_category, location, reservation_model, initial_invoice_model, start_date_time, end_date_time, last_renewal_date_time, next_renewal_date_time, auto_renew, sku, price, price_unit, assigned_resource_id, next_billing_date].hash
512
+ [id, product_code, product_category, location, reservation_model, term, reservation_state, initial_invoice_model, quantity, start_date_time, end_date_time, last_renewal_date_time, next_renewal_date_time, auto_renew, sku, price, price_unit, assigned_resource_id, next_billing_date, utilization].hash
337
513
  end
338
514
 
339
515
  # Builds the object from hash
@@ -359,61 +535,6 @@ module BillingApi
359
535
  new(transformed_hash)
360
536
  end
361
537
 
362
- # Deserializes the data based on type
363
- # @param string type Data type
364
- # @param string value Value to be deserialized
365
- # @return [Object] Deserialized data
366
- def self._deserialize(type, value)
367
- case type.to_sym
368
- when :Time
369
- Time.parse(value)
370
- when :Date
371
- Date.parse(value)
372
- when :String
373
- value.to_s
374
- when :Integer
375
- value.to_i
376
- when :Float
377
- value.to_f
378
- when :Boolean
379
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
380
- true
381
- else
382
- false
383
- end
384
- when :Object
385
- # generic object (usually a Hash), return directly
386
- value
387
- when /\AArray<(?<inner_type>.+)>\z/
388
- inner_type = Regexp.last_match[:inner_type]
389
- value.map { |v| _deserialize(inner_type, v) }
390
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
391
- k_type = Regexp.last_match[:k_type]
392
- v_type = Regexp.last_match[:v_type]
393
- {}.tap do |hash|
394
- value.each do |k, v|
395
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
396
- end
397
- end
398
- else # model
399
- # models (e.g. Pet) or oneOf
400
- klass = BillingApi.const_get(type)
401
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
402
- end
403
- end
404
-
405
- # Returns the string representation of the object
406
- # @return [String] String presentation of the object
407
- def to_s
408
- to_hash.to_s
409
- end
410
-
411
- # to_body is an alias to to_hash (backward compatibility)
412
- # @return [Hash] Returns the object in the form of hash
413
- def to_body
414
- to_hash
415
- end
416
-
417
538
  # Returns the object in the form of hash
418
539
  # @return [Hash] Returns the object in the form of hash
419
540
  def to_hash
@@ -430,24 +551,6 @@ module BillingApi
430
551
  hash
431
552
  end
432
553
 
433
- # Outputs non-array value in the form of hash
434
- # For object, use to_hash. Otherwise, just return the value
435
- # @param [Object] value Any valid value
436
- # @return [Hash] Returns the value in the form of hash
437
- def _to_hash(value)
438
- if value.is_a?(Array)
439
- value.compact.map { |v| _to_hash(v) }
440
- elsif value.is_a?(Hash)
441
- {}.tap do |hash|
442
- value.each { |k, v| hash[k] = _to_hash(v) }
443
- end
444
- elsif value.respond_to? :to_hash
445
- value.to_hash
446
- else
447
- value
448
- end
449
- end
450
-
451
554
  end
452
555
 
453
556
  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
  # Disabling auto-renewal for reservation request.
18
- class ReservationAutoRenewDisableRequest
18
+ class ReservationAutoRenewDisableRequest < ApiModelBase
19
19
  attr_accessor :auto_renew_disable_reason
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::ReservationAutoRenewDisableRequest`. 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::ReservationAutoRenewDisableRequest`. 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
@@ -0,0 +1,158 @@
1
+ =begin
2
+ #Billing API
3
+
4
+ #Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/phoenixnap-bare-metal-cloud-billing-models' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/billing/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.20.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BillingApi
17
+ # Details of a Reservation entry inside Rated Usage.
18
+ class ReservationDetails < ApiModelBase
19
+ # The Reservation identifier.
20
+ attr_accessor :id
21
+
22
+ attr_accessor :quantity
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'quantity' => :'quantity'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'quantity' => :'Quantity'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::ReservationDetails` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ReservationDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.key?(:'quantity')
77
+ self.quantity = attributes[:'quantity']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ id == o.id &&
102
+ quantity == o.quantity
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [id, quantity].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Returns the object in the form of hash
141
+ # @return [Hash] Returns the object in the form of hash
142
+ def to_hash
143
+ hash = {}
144
+ self.class.attribute_map.each_pair do |attr, param|
145
+ value = self.send(attr)
146
+ if value.nil?
147
+ is_nullable = self.class.openapi_nullable.include?(attr)
148
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
149
+ end
150
+
151
+ hash[param] = _to_hash(value)
152
+ end
153
+ hash
154
+ end
155
+
156
+ end
157
+
158
+ end