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
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module BillingApi
17
- class ServerRecord
17
+ class ServerRecord < 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' => :'ServerDetails'
@@ -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::ServerRecord`. 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::ServerRecord`. 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
  # Details of the storage associated with this rated usage record.
18
- class StorageDetails
18
+ class StorageDetails < ApiModelBase
19
19
  # Network storage ID.
20
20
  attr_accessor :network_storage_id
21
21
 
@@ -46,9 +46,14 @@ module BillingApi
46
46
  }
47
47
  end
48
48
 
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
49
54
  # Returns all the JSON keys this model knows about
50
55
  def self.acceptable_attributes
51
- attribute_map.values
56
+ acceptable_attribute_map.values
52
57
  end
53
58
 
54
59
  # Attribute type mapping.
@@ -77,35 +82,28 @@ module BillingApi
77
82
  end
78
83
 
79
84
  # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
86
  attributes = attributes.each_with_object({}) { |(k, v), h|
81
- if (!self.class.attribute_map.key?(k.to_sym))
82
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::StorageDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::StorageDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
89
  end
84
90
  h[k.to_sym] = v
85
91
  }
86
92
 
87
93
  if attributes.key?(:'network_storage_id')
88
94
  self.network_storage_id = attributes[:'network_storage_id']
89
- else
90
- self.network_storage_id = nil
91
95
  end
92
96
 
93
97
  if attributes.key?(:'network_storage_name')
94
98
  self.network_storage_name = attributes[:'network_storage_name']
95
- else
96
- self.network_storage_name = nil
97
99
  end
98
100
 
99
101
  if attributes.key?(:'volume_id')
100
102
  self.volume_id = attributes[:'volume_id']
101
- else
102
- self.volume_id = nil
103
103
  end
104
104
 
105
105
  if attributes.key?(:'volume_name')
106
106
  self.volume_name = attributes[:'volume_name']
107
- else
108
- self.volume_name = nil
109
107
  end
110
108
 
111
109
  if attributes.key?(:'capacity_in_gb')
@@ -116,8 +114,6 @@ module BillingApi
116
114
 
117
115
  if attributes.key?(:'created_on')
118
116
  self.created_on = attributes[:'created_on']
119
- else
120
- self.created_on = nil
121
117
  end
122
118
  end
123
119
 
@@ -126,30 +122,10 @@ module BillingApi
126
122
  def list_invalid_properties
127
123
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
124
  invalid_properties = Array.new
129
- if @network_storage_id.nil?
130
- invalid_properties.push('invalid value for "network_storage_id", network_storage_id cannot be nil.')
131
- end
132
-
133
- if @network_storage_name.nil?
134
- invalid_properties.push('invalid value for "network_storage_name", network_storage_name cannot be nil.')
135
- end
136
-
137
- if @volume_id.nil?
138
- invalid_properties.push('invalid value for "volume_id", volume_id cannot be nil.')
139
- end
140
-
141
- if @volume_name.nil?
142
- invalid_properties.push('invalid value for "volume_name", volume_name cannot be nil.')
143
- end
144
-
145
125
  if @capacity_in_gb.nil?
146
126
  invalid_properties.push('invalid value for "capacity_in_gb", capacity_in_gb cannot be nil.')
147
127
  end
148
128
 
149
- if @created_on.nil?
150
- invalid_properties.push('invalid value for "created_on", created_on cannot be nil.')
151
- end
152
-
153
129
  invalid_properties
154
130
  end
155
131
 
@@ -157,15 +133,20 @@ module BillingApi
157
133
  # @return true if the model is valid
158
134
  def valid?
159
135
  warn '[DEPRECATED] the `valid?` method is obsolete'
160
- return false if @network_storage_id.nil?
161
- return false if @network_storage_name.nil?
162
- return false if @volume_id.nil?
163
- return false if @volume_name.nil?
164
136
  return false if @capacity_in_gb.nil?
165
- return false if @created_on.nil?
166
137
  true
167
138
  end
168
139
 
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] capacity_in_gb Value to be assigned
142
+ def capacity_in_gb=(capacity_in_gb)
143
+ if capacity_in_gb.nil?
144
+ fail ArgumentError, 'capacity_in_gb cannot be nil'
145
+ end
146
+
147
+ @capacity_in_gb = capacity_in_gb
148
+ end
149
+
169
150
  # Checks equality by comparing each attribute.
170
151
  # @param [Object] Object to be compared
171
152
  def ==(o)
@@ -214,61 +195,6 @@ module BillingApi
214
195
  new(transformed_hash)
215
196
  end
216
197
 
217
- # Deserializes the data based on type
218
- # @param string type Data type
219
- # @param string value Value to be deserialized
220
- # @return [Object] Deserialized data
221
- def self._deserialize(type, value)
222
- case type.to_sym
223
- when :Time
224
- Time.parse(value)
225
- when :Date
226
- Date.parse(value)
227
- when :String
228
- value.to_s
229
- when :Integer
230
- value.to_i
231
- when :Float
232
- value.to_f
233
- when :Boolean
234
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
- true
236
- else
237
- false
238
- end
239
- when :Object
240
- # generic object (usually a Hash), return directly
241
- value
242
- when /\AArray<(?<inner_type>.+)>\z/
243
- inner_type = Regexp.last_match[:inner_type]
244
- value.map { |v| _deserialize(inner_type, v) }
245
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
- k_type = Regexp.last_match[:k_type]
247
- v_type = Regexp.last_match[:v_type]
248
- {}.tap do |hash|
249
- value.each do |k, v|
250
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
- end
252
- end
253
- else # model
254
- # models (e.g. Pet) or oneOf
255
- klass = BillingApi.const_get(type)
256
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
257
- end
258
- end
259
-
260
- # Returns the string representation of the object
261
- # @return [String] String presentation of the object
262
- def to_s
263
- to_hash.to_s
264
- end
265
-
266
- # to_body is an alias to to_hash (backward compatibility)
267
- # @return [Hash] Returns the object in the form of hash
268
- def to_body
269
- to_hash
270
- end
271
-
272
198
  # Returns the object in the form of hash
273
199
  # @return [Hash] Returns the object in the form of hash
274
200
  def to_hash
@@ -285,24 +211,6 @@ module BillingApi
285
211
  hash
286
212
  end
287
213
 
288
- # Outputs non-array value in the form of hash
289
- # For object, use to_hash. Otherwise, just return the value
290
- # @param [Object] value Any valid value
291
- # @return [Hash] Returns the value in the form of hash
292
- def _to_hash(value)
293
- if value.is_a?(Array)
294
- value.compact.map { |v| _to_hash(v) }
295
- elsif value.is_a?(Hash)
296
- {}.tap do |hash|
297
- value.each { |k, v| hash[k] = _to_hash(v) }
298
- end
299
- elsif value.respond_to? :to_hash
300
- value.to_hash
301
- else
302
- value
303
- end
304
- end
305
-
306
214
  end
307
215
 
308
216
  end