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
  # Info about location, solutions and availability for a product.
18
- class LocationAvailabilityDetail
18
+ class LocationAvailabilityDetail < ApiModelBase
19
19
  attr_accessor :location
20
20
 
21
21
  # Requested quantity.
@@ -63,15 +63,20 @@ module BillingApi
63
63
  }
64
64
  end
65
65
 
66
+ # Returns attribute mapping this model knows about
67
+ def self.acceptable_attribute_map
68
+ attribute_map
69
+ end
70
+
66
71
  # Returns all the JSON keys this model knows about
67
72
  def self.acceptable_attributes
68
- attribute_map.values
73
+ acceptable_attribute_map.values
69
74
  end
70
75
 
71
76
  # Attribute type mapping.
72
77
  def self.openapi_types
73
78
  {
74
- :'location' => :'LocationEnum',
79
+ :'location' => :'ProductLocationEnum',
75
80
  :'min_quantity_requested' => :'Float',
76
81
  :'min_quantity_available' => :'Boolean',
77
82
  :'available_quantity' => :'Float',
@@ -93,9 +98,10 @@ module BillingApi
93
98
  end
94
99
 
95
100
  # check to see if the attribute exists and convert string to symbol for hash key
101
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
102
  attributes = attributes.each_with_object({}) { |(k, v), h|
97
- if (!self.class.attribute_map.key?(k.to_sym))
98
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::LocationAvailabilityDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ if (!acceptable_attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::LocationAvailabilityDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
105
  end
100
106
  h[k.to_sym] = v
101
107
  }
@@ -173,6 +179,46 @@ module BillingApi
173
179
  true
174
180
  end
175
181
 
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] location Value to be assigned
184
+ def location=(location)
185
+ if location.nil?
186
+ fail ArgumentError, 'location cannot be nil'
187
+ end
188
+
189
+ @location = location
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] min_quantity_requested Value to be assigned
194
+ def min_quantity_requested=(min_quantity_requested)
195
+ if min_quantity_requested.nil?
196
+ fail ArgumentError, 'min_quantity_requested cannot be nil'
197
+ end
198
+
199
+ @min_quantity_requested = min_quantity_requested
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] min_quantity_available Value to be assigned
204
+ def min_quantity_available=(min_quantity_available)
205
+ if min_quantity_available.nil?
206
+ fail ArgumentError, 'min_quantity_available cannot be nil'
207
+ end
208
+
209
+ @min_quantity_available = min_quantity_available
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] available_quantity Value to be assigned
214
+ def available_quantity=(available_quantity)
215
+ if available_quantity.nil?
216
+ fail ArgumentError, 'available_quantity cannot be nil'
217
+ end
218
+
219
+ @available_quantity = available_quantity
220
+ end
221
+
176
222
  # Checks equality by comparing each attribute.
177
223
  # @param [Object] Object to be compared
178
224
  def ==(o)
@@ -220,61 +266,6 @@ module BillingApi
220
266
  new(transformed_hash)
221
267
  end
222
268
 
223
- # Deserializes the data based on type
224
- # @param string type Data type
225
- # @param string value Value to be deserialized
226
- # @return [Object] Deserialized data
227
- def self._deserialize(type, value)
228
- case type.to_sym
229
- when :Time
230
- Time.parse(value)
231
- when :Date
232
- Date.parse(value)
233
- when :String
234
- value.to_s
235
- when :Integer
236
- value.to_i
237
- when :Float
238
- value.to_f
239
- when :Boolean
240
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
- true
242
- else
243
- false
244
- end
245
- when :Object
246
- # generic object (usually a Hash), return directly
247
- value
248
- when /\AArray<(?<inner_type>.+)>\z/
249
- inner_type = Regexp.last_match[:inner_type]
250
- value.map { |v| _deserialize(inner_type, v) }
251
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
- k_type = Regexp.last_match[:k_type]
253
- v_type = Regexp.last_match[:v_type]
254
- {}.tap do |hash|
255
- value.each do |k, v|
256
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
- end
258
- end
259
- else # model
260
- # models (e.g. Pet) or oneOf
261
- klass = BillingApi.const_get(type)
262
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
263
- end
264
- end
265
-
266
- # Returns the string representation of the object
267
- # @return [String] String presentation of the object
268
- def to_s
269
- to_hash.to_s
270
- end
271
-
272
- # to_body is an alias to to_hash (backward compatibility)
273
- # @return [Hash] Returns the object in the form of hash
274
- def to_body
275
- to_hash
276
- end
277
-
278
269
  # Returns the object in the form of hash
279
270
  # @return [Hash] Returns the object in the form of hash
280
271
  def to_hash
@@ -291,24 +282,6 @@ module BillingApi
291
282
  hash
292
283
  end
293
284
 
294
- # Outputs non-array value in the form of hash
295
- # For object, use to_hash. Otherwise, just return the value
296
- # @param [Object] value Any valid value
297
- # @return [Hash] Returns the value in the form of hash
298
- def _to_hash(value)
299
- if value.is_a?(Array)
300
- value.compact.map { |v| _to_hash(v) }
301
- elsif value.is_a?(Hash)
302
- {}.tap do |hash|
303
- value.each { |k, v| hash[k] = _to_hash(v) }
304
- end
305
- elsif value.respond_to? :to_hash
306
- value.to_hash
307
- else
308
- value
309
- end
310
- end
311
-
312
285
  end
313
286
 
314
287
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BillingApi
17
17
  # Details of the operating system associated with this rated usage record.
18
- class OperatingSystemDetails
18
+ class OperatingSystemDetails < ApiModelBase
19
19
  # Number of cores.
20
20
  attr_accessor :cores
21
21
 
@@ -30,9 +30,14 @@ module BillingApi
30
30
  }
31
31
  end
32
32
 
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
33
38
  # Returns all the JSON keys this model knows about
34
39
  def self.acceptable_attributes
35
- attribute_map.values
40
+ acceptable_attribute_map.values
36
41
  end
37
42
 
38
43
  # Attribute type mapping.
@@ -57,9 +62,10 @@ module BillingApi
57
62
  end
58
63
 
59
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::OperatingSystemDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::OperatingSystemDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
69
  end
64
70
  h[k.to_sym] = v
65
71
  }
@@ -102,6 +108,26 @@ module BillingApi
102
108
  true
103
109
  end
104
110
 
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] cores Value to be assigned
113
+ def cores=(cores)
114
+ if cores.nil?
115
+ fail ArgumentError, 'cores cannot be nil'
116
+ end
117
+
118
+ @cores = cores
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] correlation_id Value to be assigned
123
+ def correlation_id=(correlation_id)
124
+ if correlation_id.nil?
125
+ fail ArgumentError, 'correlation_id cannot be nil'
126
+ end
127
+
128
+ @correlation_id = correlation_id
129
+ end
130
+
105
131
  # Checks equality by comparing each attribute.
106
132
  # @param [Object] Object to be compared
107
133
  def ==(o)
@@ -146,61 +172,6 @@ module BillingApi
146
172
  new(transformed_hash)
147
173
  end
148
174
 
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def self._deserialize(type, value)
154
- case type.to_sym
155
- when :Time
156
- Time.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :Boolean
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
- when :Object
172
- # generic object (usually a Hash), return directly
173
- value
174
- when /\AArray<(?<inner_type>.+)>\z/
175
- inner_type = Regexp.last_match[:inner_type]
176
- value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
- k_type = Regexp.last_match[:k_type]
179
- v_type = Regexp.last_match[:v_type]
180
- {}.tap do |hash|
181
- value.each do |k, v|
182
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
- end
184
- end
185
- else # model
186
- # models (e.g. Pet) or oneOf
187
- klass = BillingApi.const_get(type)
188
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
- end
190
- end
191
-
192
- # Returns the string representation of the object
193
- # @return [String] String presentation of the object
194
- def to_s
195
- to_hash.to_s
196
- end
197
-
198
- # to_body is an alias to to_hash (backward compatibility)
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_body
201
- to_hash
202
- end
203
-
204
175
  # Returns the object in the form of hash
205
176
  # @return [Hash] Returns the object in the form of hash
206
177
  def to_hash
@@ -217,24 +188,6 @@ module BillingApi
217
188
  hash
218
189
  end
219
190
 
220
- # Outputs non-array value in the form of hash
221
- # For object, use to_hash. Otherwise, just return the value
222
- # @param [Object] value Any valid value
223
- # @return [Hash] Returns the value in the form of hash
224
- def _to_hash(value)
225
- if value.is_a?(Array)
226
- value.compact.map { |v| _to_hash(v) }
227
- elsif value.is_a?(Hash)
228
- {}.tap do |hash|
229
- value.each { |k, v| hash[k] = _to_hash(v) }
230
- end
231
- elsif value.respond_to? :to_hash
232
- value.to_hash
233
- else
234
- value
235
- end
236
- end
237
-
238
191
  end
239
192
 
240
193
  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 OperatingSystemRecord
17
+ class OperatingSystemRecord < 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' => :'OperatingSystemDetails'
@@ -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::OperatingSystemRecord`. 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::OperatingSystemRecord`. 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