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
@@ -0,0 +1,40 @@
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 CreditTypeEnum
18
+ PROMO = "PROMO".freeze
19
+ SYSTEM = "SYSTEM".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [PROMO, SYSTEM].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if CreditTypeEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #CreditTypeEnum"
38
+ end
39
+ end
40
+ end
@@ -19,7 +19,6 @@ module BillingApi
19
19
  # A unique code associated with the discount.
20
20
  attr_accessor :code
21
21
 
22
- # The type of discount applied.
23
22
  attr_accessor :type
24
23
 
25
24
  # The value or amount of the discount. The interpretation of this value depends on the 'type' of discount.
@@ -65,7 +64,7 @@ module BillingApi
65
64
  def self.openapi_types
66
65
  {
67
66
  :'code' => :'String',
68
- :'type' => :'String',
67
+ :'type' => :'DiscountTypeEnum',
69
68
  :'value' => :'Float'
70
69
  }
71
70
  end
@@ -136,22 +135,10 @@ module BillingApi
136
135
  warn '[DEPRECATED] the `valid?` method is obsolete'
137
136
  return false if @code.nil?
138
137
  return false if @type.nil?
139
- type_validator = EnumAttributeValidator.new('String', ["PRODUCT_CATEGORY_PERCENTAGE", "GLOBAL_PERCENTAGE"])
140
- return false unless type_validator.valid?(@type)
141
138
  return false if @value.nil?
142
139
  true
143
140
  end
144
141
 
145
- # Custom attribute writer method checking allowed values (enum).
146
- # @param [Object] type Object to be assigned
147
- def type=(type)
148
- validator = EnumAttributeValidator.new('String', ["PRODUCT_CATEGORY_PERCENTAGE", "GLOBAL_PERCENTAGE"])
149
- unless validator.valid?(type)
150
- fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
151
- end
152
- @type = type
153
- end
154
-
155
142
  # Checks equality by comparing each attribute.
156
143
  # @param [Object] Object to be compared
157
144
  def ==(o)
@@ -0,0 +1,41 @@
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 DiscountTypeEnum
18
+ PRODUCT_CODE_PERCENTAGE = "PRODUCT_CODE_PERCENTAGE".freeze
19
+ PRODUCT_CATEGORY_PERCENTAGE = "PRODUCT_CATEGORY_PERCENTAGE".freeze
20
+ GLOBAL_PERCENTAGE = "GLOBAL_PERCENTAGE".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [PRODUCT_CODE_PERCENTAGE, PRODUCT_CATEGORY_PERCENTAGE, GLOBAL_PERCENTAGE].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if DiscountTypeEnum.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #DiscountTypeEnum"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,226 @@
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
+ # GPU configuration details.
18
+ class GpuConfigurationMetadata
19
+ # GPU card count.
20
+ attr_accessor :count
21
+
22
+ # GPU name.
23
+ attr_accessor :name
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'count' => :'count',
29
+ :'name' => :'name'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'count' => :'Float',
42
+ :'name' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::GpuConfigurationMetadata` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ 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::GpuConfigurationMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'count')
68
+ self.count = attributes[:'count']
69
+ end
70
+
71
+ if attributes.key?(:'name')
72
+ self.name = attributes[:'name']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ warn '[DEPRECATED] the `valid?` method is obsolete'
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ count == o.count &&
97
+ name == o.name
98
+ end
99
+
100
+ # @see the `==` method
101
+ # @param [Object] Object to be compared
102
+ def eql?(o)
103
+ self == o
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Integer] Hash code
108
+ def hash
109
+ [count, name].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def self.build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ attributes = attributes.transform_keys(&:to_sym)
118
+ transformed_hash = {}
119
+ openapi_types.each_pair do |key, type|
120
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
+ transformed_hash["#{key}"] = nil
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[attribute_map[key]].is_a?(Array)
126
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
127
+ end
128
+ elsif !attributes[attribute_map[key]].nil?
129
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
130
+ end
131
+ end
132
+ new(transformed_hash)
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def self._deserialize(type, value)
140
+ case type.to_sym
141
+ when :Time
142
+ Time.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :Boolean
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ # models (e.g. Pet) or oneOf
173
+ klass = BillingApi.const_get(type)
174
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ if value.nil?
197
+ is_nullable = self.class.openapi_nullable.include?(attr)
198
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
199
+ end
200
+
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+ end
225
+
226
+ 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',
@@ -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' => :'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,40 @@
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 PackageUnitEnum
18
+ GB = "GB".freeze
19
+ TB = "TB".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [GB, TB].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if PackageUnitEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #PackageUnitEnum"
38
+ end
39
+ end
40
+ end
@@ -41,7 +41,6 @@ module BillingApi
41
41
  # Package size per month.
42
42
  attr_accessor :package_quantity
43
43
 
44
- # Package size unit.
45
44
  attr_accessor :package_unit
46
45
 
47
46
  class EnumAttributeValidator
@@ -99,7 +98,7 @@ module BillingApi
99
98
  :'applicable_discounts' => :'ApplicableDiscounts',
100
99
  :'correlated_product_code' => :'String',
101
100
  :'package_quantity' => :'Float',
102
- :'package_unit' => :'String'
101
+ :'package_unit' => :'PackageUnitEnum'
103
102
  }
104
103
  end
105
104
 
@@ -216,8 +215,6 @@ module BillingApi
216
215
  return false unless pricing_model_validator.valid?(@pricing_model)
217
216
  return false if @price.nil?
218
217
  return false if @price_unit.nil?
219
- package_unit_validator = EnumAttributeValidator.new('String', ["GB", "TB"])
220
- return false unless package_unit_validator.valid?(@package_unit)
221
218
  true
222
219
  end
223
220
 
@@ -241,16 +238,6 @@ module BillingApi
241
238
  @pricing_model = pricing_model
242
239
  end
243
240
 
244
- # Custom attribute writer method checking allowed values (enum).
245
- # @param [Object] package_unit Object to be assigned
246
- def package_unit=(package_unit)
247
- validator = EnumAttributeValidator.new('String', ["GB", "TB"])
248
- unless validator.valid?(package_unit)
249
- fail ArgumentError, "invalid value for \"package_unit\", must be one of #{validator.allowable_values}."
250
- end
251
- @package_unit = package_unit
252
- end
253
-
254
241
  # Checks equality by comparing each attribute.
255
242
  # @param [Object] Object to be compared
256
243
  def ==(o)