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.
- checksums.yaml +4 -4
- data/README.md +16 -5
- data/VERSION +1 -1
- data/docs/BandwidthRecord.md +4 -2
- data/docs/CreditDetails.md +49 -0
- data/docs/CreditDetailsBase.md +20 -0
- data/docs/CreditTypeEnum.md +15 -0
- data/docs/DiscountDetails.md +2 -2
- data/docs/DiscountTypeEnum.md +15 -0
- data/docs/GpuConfigurationMetadata.md +20 -0
- data/docs/OperatingSystemRecord.md +4 -2
- data/docs/PackageUnitEnum.md +15 -0
- data/docs/PricingPlan.md +3 -3
- data/docs/ProductAvailabilityApi.md +89 -0
- data/docs/ProductsApi.md +0 -82
- data/docs/PromoCreditDetails.md +24 -0
- data/docs/PublicSubnetRecord.md +4 -2
- data/docs/RatedUsageProductCategoryEnum.md +15 -0
- data/docs/RatedUsageRecord.md +5 -3
- data/docs/Reservation.md +2 -2
- data/docs/ReservationAutoRenewDisableRequest.md +1 -1
- data/docs/ReservationProductCategoryEnum.md +15 -0
- data/docs/ReservationsApi.md +30 -30
- data/docs/ServerProductMetadata.md +3 -1
- data/docs/ServerRecord.md +4 -2
- data/docs/StorageRecord.md +4 -2
- data/docs/SystemCreditCauseEnum.md +15 -0
- data/docs/SystemCreditDetails.md +22 -0
- data/lib/pnap_billing_api/api/product_availability_api.rb +105 -0
- data/lib/pnap_billing_api/api/products_api.rb +0 -83
- data/lib/pnap_billing_api/api/reservations_api.rb +38 -38
- data/lib/pnap_billing_api/api_client.rb +2 -2
- data/lib/pnap_billing_api/models/bandwidth_record.rb +13 -15
- data/lib/pnap_billing_api/models/credit_details.rb +105 -0
- data/lib/pnap_billing_api/models/credit_details_base.rb +261 -0
- data/lib/pnap_billing_api/models/credit_type_enum.rb +40 -0
- data/lib/pnap_billing_api/models/discount_details.rb +1 -14
- data/lib/pnap_billing_api/models/discount_type_enum.rb +41 -0
- data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +226 -0
- data/lib/pnap_billing_api/models/operating_system_record.rb +13 -15
- data/lib/pnap_billing_api/models/package_unit_enum.rb +40 -0
- data/lib/pnap_billing_api/models/pricing_plan.rb +1 -14
- data/lib/pnap_billing_api/models/promo_credit_details.rb +301 -0
- data/lib/pnap_billing_api/models/public_subnet_record.rb +13 -15
- data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +43 -0
- data/lib/pnap_billing_api/models/rated_usage_record.rb +16 -18
- data/lib/pnap_billing_api/models/reservation.rb +1 -14
- data/lib/pnap_billing_api/models/reservation_product_category_enum.rb +40 -0
- data/lib/pnap_billing_api/models/server_product_metadata.rb +16 -4
- data/lib/pnap_billing_api/models/server_record.rb +13 -15
- data/lib/pnap_billing_api/models/storage_record.rb +13 -15
- data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +39 -0
- data/lib/pnap_billing_api/models/system_credit_details.rb +283 -0
- data/lib/pnap_billing_api.rb +12 -0
- data/spec/api/product_availability_api_spec.rb +52 -0
- data/spec/api/products_api_spec.rb +0 -17
- data/spec/api/reservations_api_spec.rb +5 -5
- data/spec/models/bandwidth_record_spec.rb +6 -4
- data/spec/models/credit_details_base_spec.rb +42 -0
- data/spec/models/credit_details_spec.rb +32 -0
- data/spec/models/credit_type_enum_spec.rb +30 -0
- data/spec/models/discount_details_spec.rb +0 -4
- data/spec/models/discount_type_enum_spec.rb +30 -0
- data/spec/models/gpu_configuration_metadata_spec.rb +42 -0
- data/spec/models/operating_system_record_spec.rb +6 -4
- data/spec/models/package_unit_enum_spec.rb +30 -0
- data/spec/models/pricing_plan_spec.rb +0 -4
- data/spec/models/promo_credit_details_spec.rb +54 -0
- data/spec/models/public_subnet_record_spec.rb +6 -4
- data/spec/models/rated_usage_product_category_enum_spec.rb +30 -0
- data/spec/models/rated_usage_record_spec.rb +6 -4
- data/spec/models/reservation_product_category_enum_spec.rb +30 -0
- data/spec/models/reservation_spec.rb +0 -4
- data/spec/models/server_product_metadata_spec.rb +6 -0
- data/spec/models/server_record_spec.rb +6 -4
- data/spec/models/storage_record_spec.rb +6 -4
- data/spec/models/system_credit_cause_enum_spec.rb +30 -0
- data/spec/models/system_credit_details_spec.rb +48 -0
- metadata +77 -29
@@ -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' => :'
|
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' => :'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' => :'
|
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' => :'DiscountDetails',
|
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
|
@@ -22,7 +22,6 @@ module BillingApi
|
|
22
22
|
# The code identifying the product. This code has significant across all locations.
|
23
23
|
attr_accessor :product_code
|
24
24
|
|
25
|
-
# The product category.
|
26
25
|
attr_accessor :product_category
|
27
26
|
|
28
27
|
attr_accessor :location
|
@@ -114,7 +113,7 @@ module BillingApi
|
|
114
113
|
{
|
115
114
|
:'id' => :'String',
|
116
115
|
:'product_code' => :'String',
|
117
|
-
:'product_category' => :'
|
116
|
+
:'product_category' => :'ReservationProductCategoryEnum',
|
118
117
|
:'location' => :'LocationEnum',
|
119
118
|
:'reservation_model' => :'ReservationModelEnum',
|
120
119
|
:'initial_invoice_model' => :'ReservationInvoicingModelEnum',
|
@@ -292,8 +291,6 @@ module BillingApi
|
|
292
291
|
return false if @id.nil?
|
293
292
|
return false if @product_code.nil?
|
294
293
|
return false if @product_category.nil?
|
295
|
-
product_category_validator = EnumAttributeValidator.new('String', ["server", "bandwidth", "operating-system"])
|
296
|
-
return false unless product_category_validator.valid?(@product_category)
|
297
294
|
return false if @location.nil?
|
298
295
|
return false if @reservation_model.nil?
|
299
296
|
return false if @start_date_time.nil?
|
@@ -304,16 +301,6 @@ module BillingApi
|
|
304
301
|
true
|
305
302
|
end
|
306
303
|
|
307
|
-
# Custom attribute writer method checking allowed values (enum).
|
308
|
-
# @param [Object] product_category Object to be assigned
|
309
|
-
def product_category=(product_category)
|
310
|
-
validator = EnumAttributeValidator.new('String', ["server", "bandwidth", "operating-system"])
|
311
|
-
unless validator.valid?(product_category)
|
312
|
-
fail ArgumentError, "invalid value for \"product_category\", must be one of #{validator.allowable_values}."
|
313
|
-
end
|
314
|
-
@product_category = product_category
|
315
|
-
end
|
316
|
-
|
317
304
|
# Checks equality by comparing each attribute.
|
318
305
|
# @param [Object] Object to be compared
|
319
306
|
def ==(o)
|
@@ -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 ReservationProductCategoryEnum
|
18
|
+
SERVER = "server".freeze
|
19
|
+
BANDWIDTH = "bandwidth".freeze
|
20
|
+
|
21
|
+
def self.all_vars
|
22
|
+
@all_vars ||= [SERVER, BANDWIDTH].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 ReservationProductCategoryEnum.all_vars.include?(value)
|
37
|
+
raise "Invalid ENUM value #{value} for class #ReservationProductCategoryEnum"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -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
|