pnap_billing_api 1.0.0 → 2.1.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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -5
  3. data/VERSION +1 -1
  4. data/docs/BandwidthRecord.md +4 -2
  5. data/docs/CreditDetails.md +49 -0
  6. data/docs/CreditDetailsBase.md +20 -0
  7. data/docs/CreditTypeEnum.md +15 -0
  8. data/docs/DiscountDetails.md +2 -2
  9. data/docs/DiscountTypeEnum.md +15 -0
  10. data/docs/GpuConfigurationMetadata.md +20 -0
  11. data/docs/OperatingSystemRecord.md +4 -2
  12. data/docs/PackageUnitEnum.md +15 -0
  13. data/docs/PricingPlan.md +3 -3
  14. data/docs/ProductAvailabilityApi.md +89 -0
  15. data/docs/ProductsApi.md +0 -82
  16. data/docs/PromoCreditDetails.md +24 -0
  17. data/docs/PublicSubnetRecord.md +4 -2
  18. data/docs/RatedUsageProductCategoryEnum.md +15 -0
  19. data/docs/RatedUsageRecord.md +5 -3
  20. data/docs/Reservation.md +2 -2
  21. data/docs/ReservationAutoRenewDisableRequest.md +1 -1
  22. data/docs/ReservationProductCategoryEnum.md +15 -0
  23. data/docs/ReservationsApi.md +30 -30
  24. data/docs/ServerProductMetadata.md +3 -1
  25. data/docs/ServerRecord.md +4 -2
  26. data/docs/StorageRecord.md +4 -2
  27. data/docs/SystemCreditCauseEnum.md +15 -0
  28. data/docs/SystemCreditDetails.md +22 -0
  29. data/lib/pnap_billing_api/api/product_availability_api.rb +105 -0
  30. data/lib/pnap_billing_api/api/products_api.rb +0 -83
  31. data/lib/pnap_billing_api/api/reservations_api.rb +38 -38
  32. data/lib/pnap_billing_api/api_client.rb +2 -2
  33. data/lib/pnap_billing_api/models/bandwidth_record.rb +13 -15
  34. data/lib/pnap_billing_api/models/credit_details.rb +105 -0
  35. data/lib/pnap_billing_api/models/credit_details_base.rb +261 -0
  36. data/lib/pnap_billing_api/models/credit_type_enum.rb +40 -0
  37. data/lib/pnap_billing_api/models/discount_details.rb +1 -14
  38. data/lib/pnap_billing_api/models/discount_type_enum.rb +41 -0
  39. data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +226 -0
  40. data/lib/pnap_billing_api/models/operating_system_record.rb +13 -15
  41. data/lib/pnap_billing_api/models/package_unit_enum.rb +40 -0
  42. data/lib/pnap_billing_api/models/pricing_plan.rb +1 -14
  43. data/lib/pnap_billing_api/models/promo_credit_details.rb +301 -0
  44. data/lib/pnap_billing_api/models/public_subnet_record.rb +13 -15
  45. data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +43 -0
  46. data/lib/pnap_billing_api/models/rated_usage_record.rb +16 -18
  47. data/lib/pnap_billing_api/models/reservation.rb +1 -14
  48. data/lib/pnap_billing_api/models/reservation_product_category_enum.rb +40 -0
  49. data/lib/pnap_billing_api/models/server_product_metadata.rb +16 -4
  50. data/lib/pnap_billing_api/models/server_record.rb +13 -15
  51. data/lib/pnap_billing_api/models/storage_record.rb +13 -15
  52. data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +39 -0
  53. data/lib/pnap_billing_api/models/system_credit_details.rb +283 -0
  54. data/lib/pnap_billing_api.rb +12 -0
  55. data/spec/api/product_availability_api_spec.rb +52 -0
  56. data/spec/api/products_api_spec.rb +0 -17
  57. data/spec/api/reservations_api_spec.rb +5 -5
  58. data/spec/models/bandwidth_record_spec.rb +6 -4
  59. data/spec/models/credit_details_base_spec.rb +42 -0
  60. data/spec/models/credit_details_spec.rb +32 -0
  61. data/spec/models/credit_type_enum_spec.rb +30 -0
  62. data/spec/models/discount_details_spec.rb +0 -4
  63. data/spec/models/discount_type_enum_spec.rb +30 -0
  64. data/spec/models/gpu_configuration_metadata_spec.rb +42 -0
  65. data/spec/models/operating_system_record_spec.rb +6 -4
  66. data/spec/models/package_unit_enum_spec.rb +30 -0
  67. data/spec/models/pricing_plan_spec.rb +0 -4
  68. data/spec/models/promo_credit_details_spec.rb +54 -0
  69. data/spec/models/public_subnet_record_spec.rb +6 -4
  70. data/spec/models/rated_usage_product_category_enum_spec.rb +30 -0
  71. data/spec/models/rated_usage_record_spec.rb +6 -4
  72. data/spec/models/reservation_product_category_enum_spec.rb +30 -0
  73. data/spec/models/reservation_spec.rb +0 -4
  74. data/spec/models/server_product_metadata_spec.rb +6 -0
  75. data/spec/models/server_record_spec.rb +6 -4
  76. data/spec/models/storage_record_spec.rb +6 -4
  77. data/spec/models/system_credit_cause_enum_spec.rb +30 -0
  78. data/spec/models/system_credit_details_spec.rb +48 -0
  79. metadata +77 -29
@@ -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',
@@ -147,6 +149,7 @@ module BillingApi
147
149
  :'correlation_id' => :'String',
148
150
  :'reservation_id' => :'String',
149
151
  :'discount_details' => :'DiscountDetails',
152
+ :'credit_details' => :'Array<CreditDetails>',
150
153
  :'metadata' => :'ServerDetails'
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
@@ -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',
@@ -147,6 +149,7 @@ module BillingApi
147
149
  :'correlation_id' => :'String',
148
150
  :'reservation_id' => :'String',
149
151
  :'discount_details' => :'DiscountDetails',
152
+ :'credit_details' => :'Array<CreditDetails>',
150
153
  :'metadata' => :'StorageDetails'
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,39 @@
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 SystemCreditCauseEnum
18
+ RESERVATION_UPGRADE = "RESERVATION_UPGRADE".freeze
19
+
20
+ def self.all_vars
21
+ @all_vars ||= [RESERVATION_UPGRADE].freeze
22
+ end
23
+
24
+ # Builds the enum from string
25
+ # @param [String] The enum value in the form of the string
26
+ # @return [String] The enum value
27
+ def self.build_from_hash(value)
28
+ new.build_from_hash(value)
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def build_from_hash(value)
35
+ return value if SystemCreditCauseEnum.all_vars.include?(value)
36
+ raise "Invalid ENUM value #{value} for class #SystemCreditCauseEnum"
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,283 @@
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 SystemCreditDetails
18
+ # Amount applied.
19
+ attr_accessor :applied_amount
20
+
21
+ attr_accessor :type
22
+
23
+ attr_accessor :cause
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'applied_amount' => :'appliedAmount',
51
+ :'type' => :'type',
52
+ :'cause' => :'cause'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'applied_amount' => :'Float',
65
+ :'type' => :'CreditTypeEnum',
66
+ :'cause' => :'SystemCreditCauseEnum'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # List of class defined in allOf (OpenAPI v3)
77
+ def self.openapi_all_of
78
+ [
79
+ :'CreditDetailsBase'
80
+ ]
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::SystemCreditDetails` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::SystemCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'applied_amount')
99
+ self.applied_amount = attributes[:'applied_amount']
100
+ else
101
+ self.applied_amount = nil
102
+ end
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ else
107
+ self.type = nil
108
+ end
109
+
110
+ if attributes.key?(:'cause')
111
+ self.cause = attributes[:'cause']
112
+ else
113
+ self.cause = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @applied_amount.nil?
123
+ invalid_properties.push('invalid value for "applied_amount", applied_amount cannot be nil.')
124
+ end
125
+
126
+ if @type.nil?
127
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
128
+ end
129
+
130
+ if @cause.nil?
131
+ invalid_properties.push('invalid value for "cause", cause cannot be nil.')
132
+ end
133
+
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ warn '[DEPRECATED] the `valid?` method is obsolete'
141
+ return false if @applied_amount.nil?
142
+ return false if @type.nil?
143
+ return false if @cause.nil?
144
+ true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ applied_amount == o.applied_amount &&
153
+ type == o.type &&
154
+ cause == o.cause
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [applied_amount, type, cause].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ openapi_types.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
+ end
185
+ elsif !attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
+ end
188
+ end
189
+ new(transformed_hash)
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def self._deserialize(type, value)
197
+ case type.to_sym
198
+ when :Time
199
+ Time.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ # models (e.g. Pet) or oneOf
230
+ klass = BillingApi.const_get(type)
231
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+
281
+ end
282
+
283
+ end
@@ -21,26 +21,35 @@ require 'pnap_billing_api/models/applicable_discounts'
21
21
  require 'pnap_billing_api/models/bandwidth_details'
22
22
  require 'pnap_billing_api/models/bandwidth_record'
23
23
  require 'pnap_billing_api/models/configuration_details'
24
+ require 'pnap_billing_api/models/credit_details'
25
+ require 'pnap_billing_api/models/credit_details_base'
26
+ require 'pnap_billing_api/models/credit_type_enum'
24
27
  require 'pnap_billing_api/models/discount_details'
28
+ require 'pnap_billing_api/models/discount_type_enum'
25
29
  require 'pnap_billing_api/models/error'
30
+ require 'pnap_billing_api/models/gpu_configuration_metadata'
26
31
  require 'pnap_billing_api/models/location_availability_detail'
27
32
  require 'pnap_billing_api/models/location_enum'
28
33
  require 'pnap_billing_api/models/operating_system_details'
29
34
  require 'pnap_billing_api/models/operating_system_record'
35
+ require 'pnap_billing_api/models/package_unit_enum'
30
36
  require 'pnap_billing_api/models/price_unit_enum'
31
37
  require 'pnap_billing_api/models/pricing_plan'
32
38
  require 'pnap_billing_api/models/product'
33
39
  require 'pnap_billing_api/models/product_availability'
34
40
  require 'pnap_billing_api/models/product_category_enum'
35
41
  require 'pnap_billing_api/models/products_get200_response_inner'
42
+ require 'pnap_billing_api/models/promo_credit_details'
36
43
  require 'pnap_billing_api/models/public_subnet_details'
37
44
  require 'pnap_billing_api/models/public_subnet_record'
38
45
  require 'pnap_billing_api/models/rated_usage_get200_response_inner'
46
+ require 'pnap_billing_api/models/rated_usage_product_category_enum'
39
47
  require 'pnap_billing_api/models/rated_usage_record'
40
48
  require 'pnap_billing_api/models/reservation'
41
49
  require 'pnap_billing_api/models/reservation_auto_renew_disable_request'
42
50
  require 'pnap_billing_api/models/reservation_invoicing_model_enum'
43
51
  require 'pnap_billing_api/models/reservation_model_enum'
52
+ require 'pnap_billing_api/models/reservation_product_category_enum'
44
53
  require 'pnap_billing_api/models/reservation_request'
45
54
  require 'pnap_billing_api/models/server_details'
46
55
  require 'pnap_billing_api/models/server_product'
@@ -48,10 +57,13 @@ require 'pnap_billing_api/models/server_product_metadata'
48
57
  require 'pnap_billing_api/models/server_record'
49
58
  require 'pnap_billing_api/models/storage_details'
50
59
  require 'pnap_billing_api/models/storage_record'
60
+ require 'pnap_billing_api/models/system_credit_cause_enum'
61
+ require 'pnap_billing_api/models/system_credit_details'
51
62
  require 'pnap_billing_api/models/threshold_configuration_details'
52
63
 
53
64
  # APIs
54
65
  require 'pnap_billing_api/api/billing_configurations_api'
66
+ require 'pnap_billing_api/api/product_availability_api'
55
67
  require 'pnap_billing_api/api/products_api'
56
68
  require 'pnap_billing_api/api/rated_usage_api'
57
69
  require 'pnap_billing_api/api/reservations_api'
@@ -0,0 +1,52 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for BillingApi::ProductAvailabilityApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'ProductAvailabilityApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = BillingApi::ProductAvailabilityApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ProductAvailabilityApi' do
30
+ it 'should create an instance of ProductAvailabilityApi' do
31
+ expect(@api_instance).to be_instance_of(BillingApi::ProductAvailabilityApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for product_availability_get
36
+ # List all Product availabilities.
37
+ # Retrieves the list of product availability details.
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Array<String>] :product_category Product category. Currently only SERVER category is supported.
40
+ # @option opts [Array<String>] :product_code
41
+ # @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered.
42
+ # @option opts [Array<LocationEnum>] :location
43
+ # @option opts [Array<String>] :solution
44
+ # @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively.
45
+ # @return [Array<ProductAvailability>]
46
+ describe 'product_availability_get test' do
47
+ it 'should work' do
48
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
49
+ end
50
+ end
51
+
52
+ end
@@ -32,23 +32,6 @@ describe 'ProductsApi' do
32
32
  end
33
33
  end
34
34
 
35
- # unit tests for product_availability_get
36
- # List all Product availabilities.
37
- # Retrieves the list of product availability details.
38
- # @param [Hash] opts the optional parameters
39
- # @option opts [Array<String>] :product_category Product category. Currently only SERVER category is supported.
40
- # @option opts [Array<String>] :product_code
41
- # @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered.
42
- # @option opts [Array<LocationEnum>] :location
43
- # @option opts [Array<String>] :solution
44
- # @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively.
45
- # @return [Array<ProductAvailability>]
46
- describe 'product_availability_get test' do
47
- it 'should work' do
48
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
49
- end
50
- end
51
-
52
35
  # unit tests for products_get
53
36
  # List all Products.
54
37
  # Retrieves all Products.
@@ -36,7 +36,7 @@ describe 'ReservationsApi' do
36
36
  # List all Reservations.
37
37
  # Retrieves all reservations associated with the authenticated account. All date &amp; times are in UTC.
38
38
  # @param [Hash] opts the optional parameters
39
- # @option opts [ProductCategoryEnum] :product_category The product category
39
+ # @option opts [ReservationProductCategoryEnum] :product_category The product category
40
40
  # @return [Array<Reservation>]
41
41
  describe 'reservations_get test' do
42
42
  it 'should work' do
@@ -59,7 +59,7 @@ describe 'ReservationsApi' do
59
59
  # unit tests for reservations_reservation_id_actions_auto_renew_disable_post
60
60
  # Disable auto-renewal for reservation by id.
61
61
  # Disable auto-renewal for reservation by reservation id.
62
- # @param reservation_id The reservation&#39;s ID.
62
+ # @param id Resource id.
63
63
  # @param [Hash] opts the optional parameters
64
64
  # @option opts [ReservationAutoRenewDisableRequest] :reservation_auto_renew_disable_request
65
65
  # @return [Reservation]
@@ -72,7 +72,7 @@ describe 'ReservationsApi' do
72
72
  # unit tests for reservations_reservation_id_actions_auto_renew_enable_post
73
73
  # Enable auto-renewal for unexpired reservation by reservation id.
74
74
  # Enable auto-renewal for unexpired reservation by reservation id.
75
- # @param reservation_id The reservation&#39;s ID.
75
+ # @param id Resource id.
76
76
  # @param [Hash] opts the optional parameters
77
77
  # @return [Reservation]
78
78
  describe 'reservations_reservation_id_actions_auto_renew_enable_post test' do
@@ -84,7 +84,7 @@ describe 'ReservationsApi' do
84
84
  # unit tests for reservations_reservation_id_actions_convert_post
85
85
  # Convert reservation pricing model by reservation ID.
86
86
  # Convert reservation pricing model by reservation id.
87
- # @param reservation_id The reservation&#39;s ID.
87
+ # @param id Resource id.
88
88
  # @param [Hash] opts the optional parameters
89
89
  # @option opts [ReservationRequest] :reservation_request
90
90
  # @return [Reservation]
@@ -97,7 +97,7 @@ describe 'ReservationsApi' do
97
97
  # unit tests for reservations_reservation_id_get
98
98
  # Get a reservation.
99
99
  # Retrieves the reservations with the specified identifier. All date &amp; times are in UTC.
100
- # @param reservation_id The reservation&#39;s ID.
100
+ # @param id Resource id.
101
101
  # @param [Hash] opts the optional parameters
102
102
  # @return [Reservation]
103
103
  describe 'reservations_reservation_id_get test' do