pnap_billing_api 2.0.0 → 2.1.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/VERSION +1 -1
  4. data/docs/ApplicableDiscountDetails.md +24 -0
  5. data/docs/ApplicableDiscounts.md +1 -1
  6. data/docs/BandwidthRecord.md +5 -3
  7. data/docs/CreditDetails.md +49 -0
  8. data/docs/CreditDetailsBase.md +20 -0
  9. data/docs/CreditTypeEnum.md +15 -0
  10. data/docs/DiscountDetails.md +2 -2
  11. data/docs/DiscountTypeEnum.md +15 -0
  12. data/docs/GpuConfigurationMetadata.md +20 -0
  13. data/docs/OperatingSystemRecord.md +5 -3
  14. data/docs/PricingPlan.md +2 -2
  15. data/docs/PromoCreditDetails.md +24 -0
  16. data/docs/PublicSubnetRecord.md +5 -3
  17. data/docs/RatedUsageProductCategoryEnum.md +15 -0
  18. data/docs/RatedUsageRecord.md +6 -4
  19. data/docs/ReservationAutoRenewDisableRequest.md +1 -1
  20. data/docs/ServerProductMetadata.md +3 -1
  21. data/docs/ServerRecord.md +5 -3
  22. data/docs/StorageRecord.md +5 -3
  23. data/docs/SystemCreditCauseEnum.md +15 -0
  24. data/docs/SystemCreditDetails.md +22 -0
  25. data/lib/pnap_billing_api/models/applicable_discount_details.rb +294 -0
  26. data/lib/pnap_billing_api/models/applicable_discounts.rb +1 -1
  27. data/lib/pnap_billing_api/models/bandwidth_record.rb +14 -16
  28. data/lib/pnap_billing_api/models/credit_details.rb +105 -0
  29. data/lib/pnap_billing_api/models/credit_details_base.rb +261 -0
  30. data/lib/pnap_billing_api/models/credit_type_enum.rb +40 -0
  31. data/lib/pnap_billing_api/models/discount_details.rb +1 -14
  32. data/lib/pnap_billing_api/models/discount_type_enum.rb +41 -0
  33. data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +226 -0
  34. data/lib/pnap_billing_api/models/operating_system_record.rb +14 -16
  35. data/lib/pnap_billing_api/models/promo_credit_details.rb +301 -0
  36. data/lib/pnap_billing_api/models/public_subnet_record.rb +14 -16
  37. data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +43 -0
  38. data/lib/pnap_billing_api/models/rated_usage_record.rb +16 -18
  39. data/lib/pnap_billing_api/models/server_product_metadata.rb +16 -4
  40. data/lib/pnap_billing_api/models/server_record.rb +14 -16
  41. data/lib/pnap_billing_api/models/storage_record.rb +14 -16
  42. data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +39 -0
  43. data/lib/pnap_billing_api/models/system_credit_details.rb +283 -0
  44. data/lib/pnap_billing_api.rb +10 -0
  45. data/spec/models/applicable_discount_details_spec.rb +54 -0
  46. data/spec/models/bandwidth_record_spec.rb +6 -4
  47. data/spec/models/credit_details_base_spec.rb +42 -0
  48. data/spec/models/credit_details_spec.rb +32 -0
  49. data/spec/models/credit_type_enum_spec.rb +30 -0
  50. data/spec/models/discount_details_spec.rb +0 -4
  51. data/spec/models/discount_type_enum_spec.rb +30 -0
  52. data/spec/models/gpu_configuration_metadata_spec.rb +42 -0
  53. data/spec/models/operating_system_record_spec.rb +6 -4
  54. data/spec/models/promo_credit_details_spec.rb +54 -0
  55. data/spec/models/public_subnet_record_spec.rb +6 -4
  56. data/spec/models/rated_usage_product_category_enum_spec.rb +30 -0
  57. data/spec/models/rated_usage_record_spec.rb +6 -4
  58. data/spec/models/server_product_metadata_spec.rb +6 -0
  59. data/spec/models/server_record_spec.rb +6 -4
  60. data/spec/models/storage_record_spec.rb +6 -4
  61. data/spec/models/system_credit_cause_enum_spec.rb +30 -0
  62. data/spec/models/system_credit_details_spec.rb +48 -0
  63. metadata +71 -31
@@ -18,7 +18,6 @@ module BillingApi
18
18
  # The unique identifier of the rated usage record.
19
19
  attr_accessor :id
20
20
 
21
- # The category of the product associated with this usage record.
22
21
  attr_accessor :product_category
23
22
 
24
23
  # The code identifying the product associated to this usage record.
@@ -70,6 +69,8 @@ module BillingApi
70
69
 
71
70
  attr_accessor :discount_details
72
71
 
72
+ attr_accessor :credit_details
73
+
73
74
  attr_accessor :metadata
74
75
 
75
76
  class EnumAttributeValidator
@@ -116,6 +117,7 @@ module BillingApi
116
117
  :'correlation_id' => :'correlationId',
117
118
  :'reservation_id' => :'reservationId',
118
119
  :'discount_details' => :'discountDetails',
120
+ :'credit_details' => :'creditDetails',
119
121
  :'metadata' => :'metadata'
120
122
  }
121
123
  end
@@ -129,7 +131,7 @@ module BillingApi
129
131
  def self.openapi_types
130
132
  {
131
133
  :'id' => :'String',
132
- :'product_category' => :'String',
134
+ :'product_category' => :'RatedUsageProductCategoryEnum',
133
135
  :'product_code' => :'String',
134
136
  :'location' => :'LocationEnum',
135
137
  :'year_month' => :'String',
@@ -146,7 +148,8 @@ module BillingApi
146
148
  :'usage_session_id' => :'String',
147
149
  :'correlation_id' => :'String',
148
150
  :'reservation_id' => :'String',
149
- :'discount_details' => :'DiscountDetails',
151
+ :'discount_details' => :'ApplicableDiscountDetails',
152
+ :'credit_details' => :'Array<CreditDetails>',
150
153
  :'metadata' => :'OperatingSystemDetails'
151
154
  }
152
155
  end
@@ -283,6 +286,12 @@ module BillingApi
283
286
  self.discount_details = attributes[:'discount_details']
284
287
  end
285
288
 
289
+ if attributes.key?(:'credit_details')
290
+ if (value = attributes[:'credit_details']).is_a?(Array)
291
+ self.credit_details = value
292
+ end
293
+ end
294
+
286
295
  if attributes.key?(:'metadata')
287
296
  self.metadata = attributes[:'metadata']
288
297
  else
@@ -364,8 +373,6 @@ module BillingApi
364
373
  warn '[DEPRECATED] the `valid?` method is obsolete'
365
374
  return false if @id.nil?
366
375
  return false if @product_category.nil?
367
- product_category_validator = EnumAttributeValidator.new('String', ["bmc-server", "bandwidth", "operating-system", "public-ip", "storage"])
368
- return false unless product_category_validator.valid?(@product_category)
369
376
  return false if @product_code.nil?
370
377
  return false if @location.nil?
371
378
  return false if @start_date_time.nil?
@@ -382,16 +389,6 @@ module BillingApi
382
389
  true
383
390
  end
384
391
 
385
- # Custom attribute writer method checking allowed values (enum).
386
- # @param [Object] product_category Object to be assigned
387
- def product_category=(product_category)
388
- validator = EnumAttributeValidator.new('String', ["bmc-server", "bandwidth", "operating-system", "public-ip", "storage"])
389
- unless validator.valid?(product_category)
390
- fail ArgumentError, "invalid value for \"product_category\", must be one of #{validator.allowable_values}."
391
- end
392
- @product_category = product_category
393
- end
394
-
395
392
  # Checks equality by comparing each attribute.
396
393
  # @param [Object] Object to be compared
397
394
  def ==(o)
@@ -416,6 +413,7 @@ module BillingApi
416
413
  correlation_id == o.correlation_id &&
417
414
  reservation_id == o.reservation_id &&
418
415
  discount_details == o.discount_details &&
416
+ credit_details == o.credit_details &&
419
417
  metadata == o.metadata
420
418
  end
421
419
 
@@ -428,7 +426,7 @@ module BillingApi
428
426
  # Calculates hash code according to all attributes.
429
427
  # @return [Integer] Hash code
430
428
  def hash
431
- [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, metadata].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
432
430
  end
433
431
 
434
432
  # Builds the object from hash
@@ -0,0 +1,301 @@
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
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BillingApi
17
+ class PromoCreditDetails
18
+ # Amount applied.
19
+ attr_accessor :applied_amount
20
+
21
+ attr_accessor :type
22
+
23
+ # Coupon id which is the source of the promo credit.
24
+ attr_accessor :coupon_id
25
+
26
+ # Coupon code which is the source of the promo credit.
27
+ attr_accessor :coupon_code
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'applied_amount' => :'appliedAmount',
55
+ :'type' => :'type',
56
+ :'coupon_id' => :'couponId',
57
+ :'coupon_code' => :'couponCode'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'applied_amount' => :'Float',
70
+ :'type' => :'CreditTypeEnum',
71
+ :'coupon_id' => :'String',
72
+ :'coupon_code' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # List of class defined in allOf (OpenAPI v3)
83
+ def self.openapi_all_of
84
+ [
85
+ :'CreditDetailsBase'
86
+ ]
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::PromoCreditDetails` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PromoCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'applied_amount')
105
+ self.applied_amount = attributes[:'applied_amount']
106
+ else
107
+ self.applied_amount = nil
108
+ end
109
+
110
+ if attributes.key?(:'type')
111
+ self.type = attributes[:'type']
112
+ else
113
+ self.type = nil
114
+ end
115
+
116
+ if attributes.key?(:'coupon_id')
117
+ self.coupon_id = attributes[:'coupon_id']
118
+ else
119
+ self.coupon_id = nil
120
+ end
121
+
122
+ if attributes.key?(:'coupon_code')
123
+ self.coupon_code = attributes[:'coupon_code']
124
+ else
125
+ self.coupon_code = nil
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
133
+ invalid_properties = Array.new
134
+ if @applied_amount.nil?
135
+ invalid_properties.push('invalid value for "applied_amount", applied_amount cannot be nil.')
136
+ end
137
+
138
+ if @type.nil?
139
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
140
+ end
141
+
142
+ if @coupon_id.nil?
143
+ invalid_properties.push('invalid value for "coupon_id", coupon_id cannot be nil.')
144
+ end
145
+
146
+ if @coupon_code.nil?
147
+ invalid_properties.push('invalid value for "coupon_code", coupon_code cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @applied_amount.nil?
158
+ return false if @type.nil?
159
+ return false if @coupon_id.nil?
160
+ return false if @coupon_code.nil?
161
+ true
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ applied_amount == o.applied_amount &&
170
+ type == o.type &&
171
+ coupon_id == o.coupon_id &&
172
+ coupon_code == o.coupon_code
173
+ end
174
+
175
+ # @see the `==` method
176
+ # @param [Object] Object to be compared
177
+ def eql?(o)
178
+ self == o
179
+ end
180
+
181
+ # Calculates hash code according to all attributes.
182
+ # @return [Integer] Hash code
183
+ def hash
184
+ [applied_amount, type, coupon_id, coupon_code].hash
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def self.build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ attributes = attributes.transform_keys(&:to_sym)
193
+ transformed_hash = {}
194
+ openapi_types.each_pair do |key, type|
195
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = nil
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[attribute_map[key]].is_a?(Array)
201
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
202
+ end
203
+ elsif !attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
205
+ end
206
+ end
207
+ new(transformed_hash)
208
+ end
209
+
210
+ # Deserializes the data based on type
211
+ # @param string type Data type
212
+ # @param string value Value to be deserialized
213
+ # @return [Object] Deserialized data
214
+ def self._deserialize(type, value)
215
+ case type.to_sym
216
+ when :Time
217
+ Time.parse(value)
218
+ when :Date
219
+ Date.parse(value)
220
+ when :String
221
+ value.to_s
222
+ when :Integer
223
+ value.to_i
224
+ when :Float
225
+ value.to_f
226
+ when :Boolean
227
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
228
+ true
229
+ else
230
+ false
231
+ end
232
+ when :Object
233
+ # generic object (usually a Hash), return directly
234
+ value
235
+ when /\AArray<(?<inner_type>.+)>\z/
236
+ inner_type = Regexp.last_match[:inner_type]
237
+ value.map { |v| _deserialize(inner_type, v) }
238
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
239
+ k_type = Regexp.last_match[:k_type]
240
+ v_type = Regexp.last_match[:v_type]
241
+ {}.tap do |hash|
242
+ value.each do |k, v|
243
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
244
+ end
245
+ end
246
+ else # model
247
+ # models (e.g. Pet) or oneOf
248
+ klass = BillingApi.const_get(type)
249
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ if value.nil?
272
+ is_nullable = self.class.openapi_nullable.include?(attr)
273
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
274
+ end
275
+
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map { |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+
299
+ end
300
+
301
+ end
@@ -18,7 +18,6 @@ module BillingApi
18
18
  # The unique identifier of the rated usage record.
19
19
  attr_accessor :id
20
20
 
21
- # The category of the product associated with this usage record.
22
21
  attr_accessor :product_category
23
22
 
24
23
  # The code identifying the product associated to this usage record.
@@ -70,6 +69,8 @@ module BillingApi
70
69
 
71
70
  attr_accessor :discount_details
72
71
 
72
+ attr_accessor :credit_details
73
+
73
74
  attr_accessor :metadata
74
75
 
75
76
  class EnumAttributeValidator
@@ -116,6 +117,7 @@ module BillingApi
116
117
  :'correlation_id' => :'correlationId',
117
118
  :'reservation_id' => :'reservationId',
118
119
  :'discount_details' => :'discountDetails',
120
+ :'credit_details' => :'creditDetails',
119
121
  :'metadata' => :'metadata'
120
122
  }
121
123
  end
@@ -129,7 +131,7 @@ module BillingApi
129
131
  def self.openapi_types
130
132
  {
131
133
  :'id' => :'String',
132
- :'product_category' => :'String',
134
+ :'product_category' => :'RatedUsageProductCategoryEnum',
133
135
  :'product_code' => :'String',
134
136
  :'location' => :'LocationEnum',
135
137
  :'year_month' => :'String',
@@ -146,7 +148,8 @@ module BillingApi
146
148
  :'usage_session_id' => :'String',
147
149
  :'correlation_id' => :'String',
148
150
  :'reservation_id' => :'String',
149
- :'discount_details' => :'DiscountDetails',
151
+ :'discount_details' => :'ApplicableDiscountDetails',
152
+ :'credit_details' => :'Array<CreditDetails>',
150
153
  :'metadata' => :'PublicSubnetDetails'
151
154
  }
152
155
  end
@@ -283,6 +286,12 @@ module BillingApi
283
286
  self.discount_details = attributes[:'discount_details']
284
287
  end
285
288
 
289
+ if attributes.key?(:'credit_details')
290
+ if (value = attributes[:'credit_details']).is_a?(Array)
291
+ self.credit_details = value
292
+ end
293
+ end
294
+
286
295
  if attributes.key?(:'metadata')
287
296
  self.metadata = attributes[:'metadata']
288
297
  else
@@ -364,8 +373,6 @@ module BillingApi
364
373
  warn '[DEPRECATED] the `valid?` method is obsolete'
365
374
  return false if @id.nil?
366
375
  return false if @product_category.nil?
367
- product_category_validator = EnumAttributeValidator.new('String', ["bmc-server", "bandwidth", "operating-system", "public-ip", "storage"])
368
- return false unless product_category_validator.valid?(@product_category)
369
376
  return false if @product_code.nil?
370
377
  return false if @location.nil?
371
378
  return false if @start_date_time.nil?
@@ -382,16 +389,6 @@ module BillingApi
382
389
  true
383
390
  end
384
391
 
385
- # Custom attribute writer method checking allowed values (enum).
386
- # @param [Object] product_category Object to be assigned
387
- def product_category=(product_category)
388
- validator = EnumAttributeValidator.new('String', ["bmc-server", "bandwidth", "operating-system", "public-ip", "storage"])
389
- unless validator.valid?(product_category)
390
- fail ArgumentError, "invalid value for \"product_category\", must be one of #{validator.allowable_values}."
391
- end
392
- @product_category = product_category
393
- end
394
-
395
392
  # Checks equality by comparing each attribute.
396
393
  # @param [Object] Object to be compared
397
394
  def ==(o)
@@ -416,6 +413,7 @@ module BillingApi
416
413
  correlation_id == o.correlation_id &&
417
414
  reservation_id == o.reservation_id &&
418
415
  discount_details == o.discount_details &&
416
+ credit_details == o.credit_details &&
419
417
  metadata == o.metadata
420
418
  end
421
419
 
@@ -428,7 +426,7 @@ module BillingApi
428
426
  # Calculates hash code according to all attributes.
429
427
  # @return [Integer] Hash code
430
428
  def hash
431
- [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, metadata].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
432
430
  end
433
431
 
434
432
  # Builds the object from hash
@@ -0,0 +1,43 @@
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
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BillingApi
17
+ class RatedUsageProductCategoryEnum
18
+ BMC_SERVER = "bmc-server".freeze
19
+ BANDWIDTH = "bandwidth".freeze
20
+ OPERATING_SYSTEM = "operating-system".freeze
21
+ PUBLIC_IP = "public-ip".freeze
22
+ STORAGE = "storage".freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [BMC_SERVER, BANDWIDTH, OPERATING_SYSTEM, PUBLIC_IP, STORAGE].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if RatedUsageProductCategoryEnum.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #RatedUsageProductCategoryEnum"
41
+ end
42
+ end
43
+ end
@@ -19,7 +19,6 @@ module BillingApi
19
19
  # The unique identifier of the rated usage record.
20
20
  attr_accessor :id
21
21
 
22
- # The category of the product associated with this usage record.
23
22
  attr_accessor :product_category
24
23
 
25
24
  # The code identifying the product associated to this usage record.
@@ -71,6 +70,8 @@ module BillingApi
71
70
 
72
71
  attr_accessor :discount_details
73
72
 
73
+ attr_accessor :credit_details
74
+
74
75
  class EnumAttributeValidator
75
76
  attr_reader :datatype
76
77
  attr_reader :allowable_values
@@ -114,7 +115,8 @@ module BillingApi
114
115
  :'usage_session_id' => :'usageSessionId',
115
116
  :'correlation_id' => :'correlationId',
116
117
  :'reservation_id' => :'reservationId',
117
- :'discount_details' => :'discountDetails'
118
+ :'discount_details' => :'discountDetails',
119
+ :'credit_details' => :'creditDetails'
118
120
  }
119
121
  end
120
122
 
@@ -127,7 +129,7 @@ module BillingApi
127
129
  def self.openapi_types
128
130
  {
129
131
  :'id' => :'String',
130
- :'product_category' => :'String',
132
+ :'product_category' => :'RatedUsageProductCategoryEnum',
131
133
  :'product_code' => :'String',
132
134
  :'location' => :'LocationEnum',
133
135
  :'year_month' => :'String',
@@ -144,7 +146,8 @@ module BillingApi
144
146
  :'usage_session_id' => :'String',
145
147
  :'correlation_id' => :'String',
146
148
  :'reservation_id' => :'String',
147
- :'discount_details' => :'DiscountDetails'
149
+ :'discount_details' => :'ApplicableDiscountDetails',
150
+ :'credit_details' => :'Array<CreditDetails>'
148
151
  }
149
152
  end
150
153
 
@@ -272,6 +275,12 @@ module BillingApi
272
275
  if attributes.key?(:'discount_details')
273
276
  self.discount_details = attributes[:'discount_details']
274
277
  end
278
+
279
+ if attributes.key?(:'credit_details')
280
+ if (value = attributes[:'credit_details']).is_a?(Array)
281
+ self.credit_details = value
282
+ end
283
+ end
275
284
  end
276
285
 
277
286
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -344,8 +353,6 @@ module BillingApi
344
353
  warn '[DEPRECATED] the `valid?` method is obsolete'
345
354
  return false if @id.nil?
346
355
  return false if @product_category.nil?
347
- product_category_validator = EnumAttributeValidator.new('String', ["bmc-server", "bandwidth", "operating-system", "public-ip", "storage"])
348
- return false unless product_category_validator.valid?(@product_category)
349
356
  return false if @product_code.nil?
350
357
  return false if @location.nil?
351
358
  return false if @start_date_time.nil?
@@ -361,16 +368,6 @@ module BillingApi
361
368
  true
362
369
  end
363
370
 
364
- # Custom attribute writer method checking allowed values (enum).
365
- # @param [Object] product_category Object to be assigned
366
- def product_category=(product_category)
367
- validator = EnumAttributeValidator.new('String', ["bmc-server", "bandwidth", "operating-system", "public-ip", "storage"])
368
- unless validator.valid?(product_category)
369
- fail ArgumentError, "invalid value for \"product_category\", must be one of #{validator.allowable_values}."
370
- end
371
- @product_category = product_category
372
- end
373
-
374
371
  # Checks equality by comparing each attribute.
375
372
  # @param [Object] Object to be compared
376
373
  def ==(o)
@@ -394,7 +391,8 @@ module BillingApi
394
391
  usage_session_id == o.usage_session_id &&
395
392
  correlation_id == o.correlation_id &&
396
393
  reservation_id == o.reservation_id &&
397
- discount_details == o.discount_details
394
+ discount_details == o.discount_details &&
395
+ credit_details == o.credit_details
398
396
  end
399
397
 
400
398
  # @see the `==` method
@@ -406,7 +404,7 @@ module BillingApi
406
404
  # Calculates hash code according to all attributes.
407
405
  # @return [Integer] Hash code
408
406
  def hash
409
- [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].hash
407
+ [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].hash
410
408
  end
411
409
 
412
410
  # Builds the object from hash