pnap_billing_api 2.1.1 → 3.0.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 +9 -0
- data/VERSION +1 -1
- data/docs/BandwidthRecord.md +4 -2
- data/docs/LocationAvailabilityDetail.md +1 -1
- data/docs/OperatingSystemRecord.md +4 -2
- data/docs/PackageDetails.md +20 -0
- data/docs/PackageQuantity.md +20 -0
- data/docs/PricingPlan.md +3 -1
- data/docs/ProductAvailabilityApi.md +4 -4
- data/docs/ProductLocationEnum.md +15 -0
- data/docs/PublicSubnetRecord.md +4 -2
- data/docs/Quantity.md +20 -0
- data/docs/QuantityUnitEnum.md +15 -0
- data/docs/RatedUsageRecord.md +4 -2
- data/docs/Reservation.md +10 -2
- data/docs/ReservationDetails.md +20 -0
- data/docs/ReservationRequest.md +3 -1
- data/docs/ReservationStateEnum.md +15 -0
- data/docs/ReservationTerm.md +20 -0
- data/docs/ReservationsApi.md +2 -2
- data/docs/ServerRecord.md +4 -2
- data/docs/StorageDetails.md +5 -5
- data/docs/StorageRecord.md +4 -2
- data/docs/Utilization.md +20 -0
- data/lib/pnap_billing_api/api/billing_configurations_api.rb +2 -2
- data/lib/pnap_billing_api/api/product_availability_api.rb +14 -6
- data/lib/pnap_billing_api/api/products_api.rb +2 -2
- data/lib/pnap_billing_api/api/rated_usage_api.rb +3 -3
- data/lib/pnap_billing_api/api/reservations_api.rb +7 -7
- data/lib/pnap_billing_api/api_client.rb +17 -14
- data/lib/pnap_billing_api/api_error.rb +1 -1
- data/lib/pnap_billing_api/api_model_base.rb +88 -0
- data/lib/pnap_billing_api/configuration.rb +11 -1
- data/lib/pnap_billing_api/models/applicable_discount_details.rb +41 -78
- data/lib/pnap_billing_api/models/applicable_discounts.rb +11 -78
- data/lib/pnap_billing_api/models/bandwidth_details.rb +31 -78
- data/lib/pnap_billing_api/models/bandwidth_record.rb +151 -93
- data/lib/pnap_billing_api/models/configuration_details.rb +11 -78
- data/lib/pnap_billing_api/models/credit_details.rb +5 -7
- data/lib/pnap_billing_api/models/credit_details_base.rb +31 -78
- data/lib/pnap_billing_api/models/credit_type_enum.rb +1 -1
- data/lib/pnap_billing_api/models/discount_details.rb +41 -78
- data/lib/pnap_billing_api/models/discount_type_enum.rb +1 -1
- data/lib/pnap_billing_api/models/error.rb +21 -78
- data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +11 -78
- data/lib/pnap_billing_api/models/location_availability_detail.rb +52 -79
- data/lib/pnap_billing_api/models/location_enum.rb +1 -1
- data/lib/pnap_billing_api/models/operating_system_details.rb +31 -78
- data/lib/pnap_billing_api/models/operating_system_record.rb +151 -93
- data/lib/pnap_billing_api/models/package_details.rb +179 -0
- data/lib/pnap_billing_api/models/package_quantity.rb +193 -0
- data/lib/pnap_billing_api/models/package_unit_enum.rb +1 -1
- data/lib/pnap_billing_api/models/price_unit_enum.rb +3 -2
- data/lib/pnap_billing_api/models/pricing_plan.rb +56 -84
- data/lib/pnap_billing_api/models/product.rb +31 -78
- data/lib/pnap_billing_api/models/product_availability.rb +41 -78
- data/lib/pnap_billing_api/models/product_category_enum.rb +1 -1
- data/lib/pnap_billing_api/models/product_location_enum.rb +44 -0
- data/lib/pnap_billing_api/models/products_get200_response_inner.rb +1 -2
- data/lib/pnap_billing_api/models/promo_credit_details.rb +51 -78
- data/lib/pnap_billing_api/models/public_subnet_details.rb +31 -78
- data/lib/pnap_billing_api/models/public_subnet_record.rb +151 -93
- data/lib/pnap_billing_api/models/quantity.rb +223 -0
- data/lib/pnap_billing_api/models/quantity_unit_enum.rb +40 -0
- data/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb +1 -2
- data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +1 -1
- data/lib/pnap_billing_api/models/rated_usage_record.rb +141 -93
- data/lib/pnap_billing_api/models/reservation.rb +186 -83
- data/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb +11 -78
- data/lib/pnap_billing_api/models/reservation_details.rb +158 -0
- data/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb +1 -1
- data/lib/pnap_billing_api/models/reservation_model_enum.rb +3 -2
- data/lib/pnap_billing_api/models/reservation_product_category_enum.rb +3 -2
- data/lib/pnap_billing_api/models/reservation_request.rb +51 -82
- data/lib/pnap_billing_api/models/reservation_state_enum.rb +44 -0
- data/lib/pnap_billing_api/models/reservation_term.rb +214 -0
- data/lib/pnap_billing_api/models/server_details.rb +31 -78
- data/lib/pnap_billing_api/models/server_product.rb +41 -78
- data/lib/pnap_billing_api/models/server_product_metadata.rb +81 -78
- data/lib/pnap_billing_api/models/server_record.rb +151 -93
- data/lib/pnap_billing_api/models/storage_details.rb +21 -113
- data/lib/pnap_billing_api/models/storage_record.rb +151 -93
- data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +1 -1
- data/lib/pnap_billing_api/models/system_credit_details.rb +41 -78
- data/lib/pnap_billing_api/models/threshold_configuration_details.rb +21 -78
- data/lib/pnap_billing_api/models/utilization.rb +208 -0
- data/lib/pnap_billing_api/version.rb +1 -2
- data/lib/pnap_billing_api.rb +11 -1
- data/pnap_billing_api.gemspec +6 -6
- data/spec/api/billing_configurations_api_spec.rb +1 -1
- data/spec/api/product_availability_api_spec.rb +3 -3
- data/spec/api/products_api_spec.rb +1 -1
- data/spec/api/rated_usage_api_spec.rb +1 -1
- data/spec/api/reservations_api_spec.rb +1 -1
- data/spec/models/applicable_discount_details_spec.rb +2 -2
- data/spec/models/applicable_discounts_spec.rb +2 -2
- data/spec/models/bandwidth_details_spec.rb +2 -2
- data/spec/models/bandwidth_record_spec.rb +8 -2
- data/spec/models/configuration_details_spec.rb +2 -2
- data/spec/models/credit_details_base_spec.rb +2 -2
- data/spec/models/credit_details_spec.rb +1 -1
- data/spec/models/credit_type_enum_spec.rb +2 -2
- data/spec/models/discount_details_spec.rb +2 -2
- data/spec/models/discount_type_enum_spec.rb +2 -2
- data/spec/models/error_spec.rb +2 -2
- data/spec/models/gpu_configuration_metadata_spec.rb +2 -2
- data/spec/models/location_availability_detail_spec.rb +2 -2
- data/spec/models/location_enum_spec.rb +2 -2
- data/spec/models/operating_system_details_spec.rb +2 -2
- data/spec/models/operating_system_record_spec.rb +8 -2
- data/spec/models/package_details_spec.rb +42 -0
- data/spec/models/package_quantity_spec.rb +42 -0
- data/spec/models/package_unit_enum_spec.rb +2 -2
- data/spec/models/price_unit_enum_spec.rb +2 -2
- data/spec/models/pricing_plan_spec.rb +9 -3
- data/spec/models/product_availability_spec.rb +2 -2
- data/spec/models/product_category_enum_spec.rb +2 -2
- data/spec/models/product_location_enum_spec.rb +30 -0
- data/spec/models/product_spec.rb +2 -2
- data/spec/models/products_get200_response_inner_spec.rb +1 -1
- data/spec/models/promo_credit_details_spec.rb +2 -2
- data/spec/models/public_subnet_details_spec.rb +2 -2
- data/spec/models/public_subnet_record_spec.rb +8 -2
- data/spec/models/quantity_spec.rb +42 -0
- data/spec/models/quantity_unit_enum_spec.rb +30 -0
- data/spec/models/rated_usage_get200_response_inner_spec.rb +1 -1
- data/spec/models/rated_usage_product_category_enum_spec.rb +2 -2
- data/spec/models/rated_usage_record_spec.rb +8 -2
- data/spec/models/reservation_auto_renew_disable_request_spec.rb +2 -2
- data/spec/models/reservation_details_spec.rb +42 -0
- data/spec/models/reservation_invoicing_model_enum_spec.rb +2 -2
- data/spec/models/reservation_model_enum_spec.rb +2 -2
- data/spec/models/reservation_product_category_enum_spec.rb +2 -2
- data/spec/models/reservation_request_spec.rb +8 -2
- data/spec/models/reservation_spec.rb +26 -2
- data/spec/models/reservation_state_enum_spec.rb +30 -0
- data/spec/models/reservation_term_spec.rb +42 -0
- data/spec/models/server_details_spec.rb +2 -2
- data/spec/models/server_product_metadata_spec.rb +2 -2
- data/spec/models/server_product_spec.rb +2 -2
- data/spec/models/server_record_spec.rb +8 -2
- data/spec/models/storage_details_spec.rb +2 -2
- data/spec/models/storage_record_spec.rb +8 -2
- data/spec/models/system_credit_cause_enum_spec.rb +2 -2
- data/spec/models/system_credit_details_spec.rb +2 -2
- data/spec/models/threshold_configuration_details_spec.rb +2 -2
- data/spec/models/utilization_spec.rb +42 -0
- data/spec/spec_helper.rb +1 -1
- metadata +84 -43
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module BillingApi
|
|
17
17
|
# Product details
|
|
18
|
-
class Product
|
|
18
|
+
class Product < ApiModelBase
|
|
19
19
|
# The code identifying the product. This code has significant across all locations.
|
|
20
20
|
attr_accessor :product_code
|
|
21
21
|
|
|
@@ -34,9 +34,14 @@ module BillingApi
|
|
|
34
34
|
}
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
# Returns attribute mapping this model knows about
|
|
38
|
+
def self.acceptable_attribute_map
|
|
39
|
+
attribute_map
|
|
40
|
+
end
|
|
41
|
+
|
|
37
42
|
# Returns all the JSON keys this model knows about
|
|
38
43
|
def self.acceptable_attributes
|
|
39
|
-
|
|
44
|
+
acceptable_attribute_map.values
|
|
40
45
|
end
|
|
41
46
|
|
|
42
47
|
# Attribute type mapping.
|
|
@@ -62,9 +67,10 @@ module BillingApi
|
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
70
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
71
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
|
-
if (!
|
|
67
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Product`. Please check the name to make sure it's valid. List of attributes: " +
|
|
72
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Product`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
74
|
end
|
|
69
75
|
h[k.to_sym] = v
|
|
70
76
|
}
|
|
@@ -113,6 +119,26 @@ module BillingApi
|
|
|
113
119
|
true
|
|
114
120
|
end
|
|
115
121
|
|
|
122
|
+
# Custom attribute writer method with validation
|
|
123
|
+
# @param [Object] product_code Value to be assigned
|
|
124
|
+
def product_code=(product_code)
|
|
125
|
+
if product_code.nil?
|
|
126
|
+
fail ArgumentError, 'product_code cannot be nil'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
@product_code = product_code
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Custom attribute writer method with validation
|
|
133
|
+
# @param [Object] product_category Value to be assigned
|
|
134
|
+
def product_category=(product_category)
|
|
135
|
+
if product_category.nil?
|
|
136
|
+
fail ArgumentError, 'product_category cannot be nil'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
@product_category = product_category
|
|
140
|
+
end
|
|
141
|
+
|
|
116
142
|
# Checks equality by comparing each attribute.
|
|
117
143
|
# @param [Object] Object to be compared
|
|
118
144
|
def ==(o)
|
|
@@ -158,61 +184,6 @@ module BillingApi
|
|
|
158
184
|
new(transformed_hash)
|
|
159
185
|
end
|
|
160
186
|
|
|
161
|
-
# Deserializes the data based on type
|
|
162
|
-
# @param string type Data type
|
|
163
|
-
# @param string value Value to be deserialized
|
|
164
|
-
# @return [Object] Deserialized data
|
|
165
|
-
def self._deserialize(type, value)
|
|
166
|
-
case type.to_sym
|
|
167
|
-
when :Time
|
|
168
|
-
Time.parse(value)
|
|
169
|
-
when :Date
|
|
170
|
-
Date.parse(value)
|
|
171
|
-
when :String
|
|
172
|
-
value.to_s
|
|
173
|
-
when :Integer
|
|
174
|
-
value.to_i
|
|
175
|
-
when :Float
|
|
176
|
-
value.to_f
|
|
177
|
-
when :Boolean
|
|
178
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
179
|
-
true
|
|
180
|
-
else
|
|
181
|
-
false
|
|
182
|
-
end
|
|
183
|
-
when :Object
|
|
184
|
-
# generic object (usually a Hash), return directly
|
|
185
|
-
value
|
|
186
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
187
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
188
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
189
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
190
|
-
k_type = Regexp.last_match[:k_type]
|
|
191
|
-
v_type = Regexp.last_match[:v_type]
|
|
192
|
-
{}.tap do |hash|
|
|
193
|
-
value.each do |k, v|
|
|
194
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
else # model
|
|
198
|
-
# models (e.g. Pet) or oneOf
|
|
199
|
-
klass = BillingApi.const_get(type)
|
|
200
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
# Returns the string representation of the object
|
|
205
|
-
# @return [String] String presentation of the object
|
|
206
|
-
def to_s
|
|
207
|
-
to_hash.to_s
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
211
|
-
# @return [Hash] Returns the object in the form of hash
|
|
212
|
-
def to_body
|
|
213
|
-
to_hash
|
|
214
|
-
end
|
|
215
|
-
|
|
216
187
|
# Returns the object in the form of hash
|
|
217
188
|
# @return [Hash] Returns the object in the form of hash
|
|
218
189
|
def to_hash
|
|
@@ -229,24 +200,6 @@ module BillingApi
|
|
|
229
200
|
hash
|
|
230
201
|
end
|
|
231
202
|
|
|
232
|
-
# Outputs non-array value in the form of hash
|
|
233
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
234
|
-
# @param [Object] value Any valid value
|
|
235
|
-
# @return [Hash] Returns the value in the form of hash
|
|
236
|
-
def _to_hash(value)
|
|
237
|
-
if value.is_a?(Array)
|
|
238
|
-
value.compact.map { |v| _to_hash(v) }
|
|
239
|
-
elsif value.is_a?(Hash)
|
|
240
|
-
{}.tap do |hash|
|
|
241
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
242
|
-
end
|
|
243
|
-
elsif value.respond_to? :to_hash
|
|
244
|
-
value.to_hash
|
|
245
|
-
else
|
|
246
|
-
value
|
|
247
|
-
end
|
|
248
|
-
end
|
|
249
|
-
|
|
250
203
|
end
|
|
251
204
|
|
|
252
205
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module BillingApi
|
|
17
17
|
# Product availability details.
|
|
18
|
-
class ProductAvailability
|
|
18
|
+
class ProductAvailability < ApiModelBase
|
|
19
19
|
# Product code.
|
|
20
20
|
attr_accessor :product_code
|
|
21
21
|
|
|
@@ -33,9 +33,14 @@ module BillingApi
|
|
|
33
33
|
}
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
# Returns attribute mapping this model knows about
|
|
37
|
+
def self.acceptable_attribute_map
|
|
38
|
+
attribute_map
|
|
39
|
+
end
|
|
40
|
+
|
|
36
41
|
# Returns all the JSON keys this model knows about
|
|
37
42
|
def self.acceptable_attributes
|
|
38
|
-
|
|
43
|
+
acceptable_attribute_map.values
|
|
39
44
|
end
|
|
40
45
|
|
|
41
46
|
# Attribute type mapping.
|
|
@@ -61,9 +66,10 @@ module BillingApi
|
|
|
61
66
|
end
|
|
62
67
|
|
|
63
68
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
69
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
64
70
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
65
|
-
if (!
|
|
66
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ProductAvailability`. Please check the name to make sure it's valid. List of attributes: " +
|
|
71
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ProductAvailability`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
67
73
|
end
|
|
68
74
|
h[k.to_sym] = v
|
|
69
75
|
}
|
|
@@ -119,6 +125,36 @@ module BillingApi
|
|
|
119
125
|
true
|
|
120
126
|
end
|
|
121
127
|
|
|
128
|
+
# Custom attribute writer method with validation
|
|
129
|
+
# @param [Object] product_code Value to be assigned
|
|
130
|
+
def product_code=(product_code)
|
|
131
|
+
if product_code.nil?
|
|
132
|
+
fail ArgumentError, 'product_code cannot be nil'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
@product_code = product_code
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Custom attribute writer method with validation
|
|
139
|
+
# @param [Object] product_category Value to be assigned
|
|
140
|
+
def product_category=(product_category)
|
|
141
|
+
if product_category.nil?
|
|
142
|
+
fail ArgumentError, 'product_category cannot be nil'
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
@product_category = product_category
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Custom attribute writer method with validation
|
|
149
|
+
# @param [Object] location_availability_details Value to be assigned
|
|
150
|
+
def location_availability_details=(location_availability_details)
|
|
151
|
+
if location_availability_details.nil?
|
|
152
|
+
fail ArgumentError, 'location_availability_details cannot be nil'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
@location_availability_details = location_availability_details
|
|
156
|
+
end
|
|
157
|
+
|
|
122
158
|
# Checks equality by comparing each attribute.
|
|
123
159
|
# @param [Object] Object to be compared
|
|
124
160
|
def ==(o)
|
|
@@ -164,61 +200,6 @@ module BillingApi
|
|
|
164
200
|
new(transformed_hash)
|
|
165
201
|
end
|
|
166
202
|
|
|
167
|
-
# Deserializes the data based on type
|
|
168
|
-
# @param string type Data type
|
|
169
|
-
# @param string value Value to be deserialized
|
|
170
|
-
# @return [Object] Deserialized data
|
|
171
|
-
def self._deserialize(type, value)
|
|
172
|
-
case type.to_sym
|
|
173
|
-
when :Time
|
|
174
|
-
Time.parse(value)
|
|
175
|
-
when :Date
|
|
176
|
-
Date.parse(value)
|
|
177
|
-
when :String
|
|
178
|
-
value.to_s
|
|
179
|
-
when :Integer
|
|
180
|
-
value.to_i
|
|
181
|
-
when :Float
|
|
182
|
-
value.to_f
|
|
183
|
-
when :Boolean
|
|
184
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
185
|
-
true
|
|
186
|
-
else
|
|
187
|
-
false
|
|
188
|
-
end
|
|
189
|
-
when :Object
|
|
190
|
-
# generic object (usually a Hash), return directly
|
|
191
|
-
value
|
|
192
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
193
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
194
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
195
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
196
|
-
k_type = Regexp.last_match[:k_type]
|
|
197
|
-
v_type = Regexp.last_match[:v_type]
|
|
198
|
-
{}.tap do |hash|
|
|
199
|
-
value.each do |k, v|
|
|
200
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
else # model
|
|
204
|
-
# models (e.g. Pet) or oneOf
|
|
205
|
-
klass = BillingApi.const_get(type)
|
|
206
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
# Returns the string representation of the object
|
|
211
|
-
# @return [String] String presentation of the object
|
|
212
|
-
def to_s
|
|
213
|
-
to_hash.to_s
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
217
|
-
# @return [Hash] Returns the object in the form of hash
|
|
218
|
-
def to_body
|
|
219
|
-
to_hash
|
|
220
|
-
end
|
|
221
|
-
|
|
222
203
|
# Returns the object in the form of hash
|
|
223
204
|
# @return [Hash] Returns the object in the form of hash
|
|
224
205
|
def to_hash
|
|
@@ -235,24 +216,6 @@ module BillingApi
|
|
|
235
216
|
hash
|
|
236
217
|
end
|
|
237
218
|
|
|
238
|
-
# Outputs non-array value in the form of hash
|
|
239
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
240
|
-
# @param [Object] value Any valid value
|
|
241
|
-
# @return [Hash] Returns the value in the form of hash
|
|
242
|
-
def _to_hash(value)
|
|
243
|
-
if value.is_a?(Array)
|
|
244
|
-
value.compact.map { |v| _to_hash(v) }
|
|
245
|
-
elsif value.is_a?(Hash)
|
|
246
|
-
{}.tap do |hash|
|
|
247
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
248
|
-
end
|
|
249
|
-
elsif value.respond_to? :to_hash
|
|
250
|
-
value.to_hash
|
|
251
|
-
else
|
|
252
|
-
value
|
|
253
|
-
end
|
|
254
|
-
end
|
|
255
|
-
|
|
256
219
|
end
|
|
257
220
|
|
|
258
221
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module BillingApi
|
|
17
|
+
class ProductLocationEnum
|
|
18
|
+
PHX = "PHX".freeze
|
|
19
|
+
ASH = "ASH".freeze
|
|
20
|
+
NLD = "NLD".freeze
|
|
21
|
+
SGP = "SGP".freeze
|
|
22
|
+
CHI = "CHI".freeze
|
|
23
|
+
SEA = "SEA".freeze
|
|
24
|
+
|
|
25
|
+
def self.all_vars
|
|
26
|
+
@all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA].freeze
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Builds the enum from string
|
|
30
|
+
# @param [String] The enum value in the form of the string
|
|
31
|
+
# @return [String] The enum value
|
|
32
|
+
def self.build_from_hash(value)
|
|
33
|
+
new.build_from_hash(value)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Builds the enum from string
|
|
37
|
+
# @param [String] The enum value in the form of the string
|
|
38
|
+
# @return [String] The enum value
|
|
39
|
+
def build_from_hash(value)
|
|
40
|
+
return value if ProductLocationEnum.all_vars.include?(value)
|
|
41
|
+
raise "Invalid ENUM value #{value} for class #ProductLocationEnum"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -57,5 +57,4 @@ module BillingApi
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
|
-
|
|
61
60
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module BillingApi
|
|
17
|
-
class PromoCreditDetails
|
|
17
|
+
class PromoCreditDetails < ApiModelBase
|
|
18
18
|
# Amount applied.
|
|
19
19
|
attr_accessor :applied_amount
|
|
20
20
|
|
|
@@ -58,9 +58,14 @@ module BillingApi
|
|
|
58
58
|
}
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
# Returns attribute mapping this model knows about
|
|
62
|
+
def self.acceptable_attribute_map
|
|
63
|
+
attribute_map
|
|
64
|
+
end
|
|
65
|
+
|
|
61
66
|
# Returns all the JSON keys this model knows about
|
|
62
67
|
def self.acceptable_attributes
|
|
63
|
-
|
|
68
|
+
acceptable_attribute_map.values
|
|
64
69
|
end
|
|
65
70
|
|
|
66
71
|
# Attribute type mapping.
|
|
@@ -94,9 +99,10 @@ module BillingApi
|
|
|
94
99
|
end
|
|
95
100
|
|
|
96
101
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
102
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
97
103
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
98
|
-
if (!
|
|
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: " +
|
|
104
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
105
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PromoCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
100
106
|
end
|
|
101
107
|
h[k.to_sym] = v
|
|
102
108
|
}
|
|
@@ -161,6 +167,46 @@ module BillingApi
|
|
|
161
167
|
true
|
|
162
168
|
end
|
|
163
169
|
|
|
170
|
+
# Custom attribute writer method with validation
|
|
171
|
+
# @param [Object] applied_amount Value to be assigned
|
|
172
|
+
def applied_amount=(applied_amount)
|
|
173
|
+
if applied_amount.nil?
|
|
174
|
+
fail ArgumentError, 'applied_amount cannot be nil'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@applied_amount = applied_amount
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Custom attribute writer method with validation
|
|
181
|
+
# @param [Object] type Value to be assigned
|
|
182
|
+
def type=(type)
|
|
183
|
+
if type.nil?
|
|
184
|
+
fail ArgumentError, 'type cannot be nil'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
@type = type
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Custom attribute writer method with validation
|
|
191
|
+
# @param [Object] coupon_id Value to be assigned
|
|
192
|
+
def coupon_id=(coupon_id)
|
|
193
|
+
if coupon_id.nil?
|
|
194
|
+
fail ArgumentError, 'coupon_id cannot be nil'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
@coupon_id = coupon_id
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Custom attribute writer method with validation
|
|
201
|
+
# @param [Object] coupon_code Value to be assigned
|
|
202
|
+
def coupon_code=(coupon_code)
|
|
203
|
+
if coupon_code.nil?
|
|
204
|
+
fail ArgumentError, 'coupon_code cannot be nil'
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
@coupon_code = coupon_code
|
|
208
|
+
end
|
|
209
|
+
|
|
164
210
|
# Checks equality by comparing each attribute.
|
|
165
211
|
# @param [Object] Object to be compared
|
|
166
212
|
def ==(o)
|
|
@@ -207,61 +253,6 @@ module BillingApi
|
|
|
207
253
|
new(transformed_hash)
|
|
208
254
|
end
|
|
209
255
|
|
|
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
256
|
# Returns the object in the form of hash
|
|
266
257
|
# @return [Hash] Returns the object in the form of hash
|
|
267
258
|
def to_hash
|
|
@@ -278,24 +269,6 @@ module BillingApi
|
|
|
278
269
|
hash
|
|
279
270
|
end
|
|
280
271
|
|
|
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
272
|
end
|
|
300
273
|
|
|
301
274
|
end
|