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
@@ -37,6 +37,9 @@ module BillingApi
37
37
  # Server storage.
38
38
  attr_accessor :storage
39
39
 
40
+ # GPU configurations
41
+ attr_accessor :gpu_configurations
42
+
40
43
  # Attribute mapping from ruby-style variable name to JSON key.
41
44
  def self.attribute_map
42
45
  {
@@ -46,7 +49,8 @@ module BillingApi
46
49
  :'cores_per_cpu' => :'coresPerCpu',
47
50
  :'cpu_frequency' => :'cpuFrequency',
48
51
  :'network' => :'network',
49
- :'storage' => :'storage'
52
+ :'storage' => :'storage',
53
+ :'gpu_configurations' => :'gpuConfigurations'
50
54
  }
51
55
  end
52
56
 
@@ -64,7 +68,8 @@ module BillingApi
64
68
  :'cores_per_cpu' => :'Float',
65
69
  :'cpu_frequency' => :'Float',
66
70
  :'network' => :'String',
67
- :'storage' => :'String'
71
+ :'storage' => :'String',
72
+ :'gpu_configurations' => :'Array<GpuConfigurationMetadata>'
68
73
  }
69
74
  end
70
75
 
@@ -130,6 +135,12 @@ module BillingApi
130
135
  else
131
136
  self.storage = nil
132
137
  end
138
+
139
+ if attributes.key?(:'gpu_configurations')
140
+ if (value = attributes[:'gpu_configurations']).is_a?(Array)
141
+ self.gpu_configurations = value
142
+ end
143
+ end
133
144
  end
134
145
 
135
146
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -193,7 +204,8 @@ module BillingApi
193
204
  cores_per_cpu == o.cores_per_cpu &&
194
205
  cpu_frequency == o.cpu_frequency &&
195
206
  network == o.network &&
196
- storage == o.storage
207
+ storage == o.storage &&
208
+ gpu_configurations == o.gpu_configurations
197
209
  end
198
210
 
199
211
  # @see the `==` method
@@ -205,7 +217,7 @@ module BillingApi
205
217
  # Calculates hash code according to all attributes.
206
218
  # @return [Integer] Hash code
207
219
  def hash
208
- [ram_in_gb, cpu, cpu_count, cores_per_cpu, cpu_frequency, network, storage].hash
220
+ [ram_in_gb, cpu, cpu_count, cores_per_cpu, cpu_frequency, network, storage, gpu_configurations].hash
209
221
  end
210
222
 
211
223
  # 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',
@@ -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' => :'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',
@@ -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' => :'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
@@ -17,12 +17,18 @@ require 'pnap_billing_api/version'
17
17
  require 'pnap_billing_api/configuration'
18
18
 
19
19
  # Models
20
+ require 'pnap_billing_api/models/applicable_discount_details'
20
21
  require 'pnap_billing_api/models/applicable_discounts'
21
22
  require 'pnap_billing_api/models/bandwidth_details'
22
23
  require 'pnap_billing_api/models/bandwidth_record'
23
24
  require 'pnap_billing_api/models/configuration_details'
25
+ require 'pnap_billing_api/models/credit_details'
26
+ require 'pnap_billing_api/models/credit_details_base'
27
+ require 'pnap_billing_api/models/credit_type_enum'
24
28
  require 'pnap_billing_api/models/discount_details'
29
+ require 'pnap_billing_api/models/discount_type_enum'
25
30
  require 'pnap_billing_api/models/error'
31
+ require 'pnap_billing_api/models/gpu_configuration_metadata'
26
32
  require 'pnap_billing_api/models/location_availability_detail'
27
33
  require 'pnap_billing_api/models/location_enum'
28
34
  require 'pnap_billing_api/models/operating_system_details'
@@ -34,9 +40,11 @@ require 'pnap_billing_api/models/product'
34
40
  require 'pnap_billing_api/models/product_availability'
35
41
  require 'pnap_billing_api/models/product_category_enum'
36
42
  require 'pnap_billing_api/models/products_get200_response_inner'
43
+ require 'pnap_billing_api/models/promo_credit_details'
37
44
  require 'pnap_billing_api/models/public_subnet_details'
38
45
  require 'pnap_billing_api/models/public_subnet_record'
39
46
  require 'pnap_billing_api/models/rated_usage_get200_response_inner'
47
+ require 'pnap_billing_api/models/rated_usage_product_category_enum'
40
48
  require 'pnap_billing_api/models/rated_usage_record'
41
49
  require 'pnap_billing_api/models/reservation'
42
50
  require 'pnap_billing_api/models/reservation_auto_renew_disable_request'
@@ -50,6 +58,8 @@ require 'pnap_billing_api/models/server_product_metadata'
50
58
  require 'pnap_billing_api/models/server_record'
51
59
  require 'pnap_billing_api/models/storage_details'
52
60
  require 'pnap_billing_api/models/storage_record'
61
+ require 'pnap_billing_api/models/system_credit_cause_enum'
62
+ require 'pnap_billing_api/models/system_credit_details'
53
63
  require 'pnap_billing_api/models/threshold_configuration_details'
54
64
 
55
65
  # APIs
@@ -0,0 +1,54 @@
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
+ require 'date'
16
+
17
+ # Unit tests for BillingApi::ApplicableDiscountDetails
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe BillingApi::ApplicableDiscountDetails do
21
+ let(:instance) { BillingApi::ApplicableDiscountDetails.new }
22
+
23
+ describe 'test an instance of ApplicableDiscountDetails' do
24
+ it 'should create an instance of ApplicableDiscountDetails' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(BillingApi::ApplicableDiscountDetails)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "code"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "type"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "value"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ describe 'test attribute "coupon_code"' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
+ end
52
+ end
53
+
54
+ end