pnap_billing_api 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/VERSION +1 -1
- data/docs/PackageUnitEnum.md +15 -0
- data/docs/PricingPlan.md +1 -1
- data/docs/ProductAvailabilityApi.md +89 -0
- data/docs/ProductsApi.md +0 -82
- data/docs/Reservation.md +2 -2
- data/docs/ReservationProductCategoryEnum.md +15 -0
- data/docs/ReservationsApi.md +30 -30
- 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/package_unit_enum.rb +40 -0
- data/lib/pnap_billing_api/models/pricing_plan.rb +1 -14
- 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.rb +3 -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/package_unit_enum_spec.rb +30 -0
- data/spec/models/pricing_plan_spec.rb +0 -4
- data/spec/models/reservation_product_category_enum_spec.rb +30 -0
- data/spec/models/reservation_spec.rb +0 -4
- metadata +39 -27
@@ -19,89 +19,6 @@ module BillingApi
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# List all Product availabilities.
|
23
|
-
# Retrieves the list of product availability details.
|
24
|
-
# @param [Hash] opts the optional parameters
|
25
|
-
# @option opts [Array<String>] :product_category Product category. Currently only SERVER category is supported.
|
26
|
-
# @option opts [Array<String>] :product_code
|
27
|
-
# @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered. (default to true)
|
28
|
-
# @option opts [Array<LocationEnum>] :location
|
29
|
-
# @option opts [Array<String>] :solution
|
30
|
-
# @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively.
|
31
|
-
# @return [Array<ProductAvailability>]
|
32
|
-
def product_availability_get(opts = {})
|
33
|
-
data, _status_code, _headers = product_availability_get_with_http_info(opts)
|
34
|
-
data
|
35
|
-
end
|
36
|
-
|
37
|
-
# List all Product availabilities.
|
38
|
-
# Retrieves the list of product availability details.
|
39
|
-
# @param [Hash] opts the optional parameters
|
40
|
-
# @option opts [Array<String>] :product_category Product category. Currently only SERVER category is supported.
|
41
|
-
# @option opts [Array<String>] :product_code
|
42
|
-
# @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered. (default to true)
|
43
|
-
# @option opts [Array<LocationEnum>] :location
|
44
|
-
# @option opts [Array<String>] :solution
|
45
|
-
# @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively.
|
46
|
-
# @return [Array<(Array<ProductAvailability>, Integer, Hash)>] Array<ProductAvailability> data, response status code and response headers
|
47
|
-
def product_availability_get_with_http_info(opts = {})
|
48
|
-
if @api_client.config.debugging
|
49
|
-
@api_client.config.logger.debug 'Calling API: ProductsApi.product_availability_get ...'
|
50
|
-
end
|
51
|
-
allowable_values = ["SERVER"]
|
52
|
-
if @api_client.config.client_side_validation && opts[:'product_category'] && !opts[:'product_category'].all? { |item| allowable_values.include?(item) }
|
53
|
-
fail ArgumentError, "invalid value for \"product_category\", must include one of #{allowable_values}"
|
54
|
-
end
|
55
|
-
allowable_values = ["SERVER_RANCHER"]
|
56
|
-
if @api_client.config.client_side_validation && opts[:'solution'] && !opts[:'solution'].all? { |item| allowable_values.include?(item) }
|
57
|
-
fail ArgumentError, "invalid value for \"solution\", must include one of #{allowable_values}"
|
58
|
-
end
|
59
|
-
# resource path
|
60
|
-
local_var_path = '/product-availability'
|
61
|
-
|
62
|
-
# query parameters
|
63
|
-
query_params = opts[:query_params] || {}
|
64
|
-
query_params[:'productCategory'] = @api_client.build_collection_param(opts[:'product_category'], :multi) if !opts[:'product_category'].nil?
|
65
|
-
query_params[:'productCode'] = @api_client.build_collection_param(opts[:'product_code'], :multi) if !opts[:'product_code'].nil?
|
66
|
-
query_params[:'showOnlyMinQuantityAvailable'] = opts[:'show_only_min_quantity_available'] if !opts[:'show_only_min_quantity_available'].nil?
|
67
|
-
query_params[:'location'] = @api_client.build_collection_param(opts[:'location'], :multi) if !opts[:'location'].nil?
|
68
|
-
query_params[:'solution'] = @api_client.build_collection_param(opts[:'solution'], :multi) if !opts[:'solution'].nil?
|
69
|
-
query_params[:'minQuantity'] = opts[:'min_quantity'] if !opts[:'min_quantity'].nil?
|
70
|
-
|
71
|
-
# header parameters
|
72
|
-
header_params = opts[:header_params] || {}
|
73
|
-
# HTTP header 'Accept' (if needed)
|
74
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
75
|
-
|
76
|
-
# form parameters
|
77
|
-
form_params = opts[:form_params] || {}
|
78
|
-
|
79
|
-
# http body (model)
|
80
|
-
post_body = opts[:debug_body]
|
81
|
-
|
82
|
-
# return_type
|
83
|
-
return_type = opts[:debug_return_type] || 'Array<ProductAvailability>'
|
84
|
-
|
85
|
-
# auth_names
|
86
|
-
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
87
|
-
|
88
|
-
new_options = opts.merge(
|
89
|
-
:operation => :"ProductsApi.product_availability_get",
|
90
|
-
:header_params => header_params,
|
91
|
-
:query_params => query_params,
|
92
|
-
:form_params => form_params,
|
93
|
-
:body => post_body,
|
94
|
-
:auth_names => auth_names,
|
95
|
-
:return_type => return_type
|
96
|
-
)
|
97
|
-
|
98
|
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
99
|
-
if @api_client.config.debugging
|
100
|
-
@api_client.config.logger.debug "API called: ProductsApi#product_availability_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
101
|
-
end
|
102
|
-
return data, status_code, headers
|
103
|
-
end
|
104
|
-
|
105
22
|
# List all Products.
|
106
23
|
# Retrieves all Products.
|
107
24
|
# @param [Hash] opts the optional parameters
|
@@ -22,7 +22,7 @@ module BillingApi
|
|
22
22
|
# List all Reservations.
|
23
23
|
# Retrieves all reservations associated with the authenticated account. All date & times are in UTC.
|
24
24
|
# @param [Hash] opts the optional parameters
|
25
|
-
# @option opts [
|
25
|
+
# @option opts [ReservationProductCategoryEnum] :product_category The product category
|
26
26
|
# @return [Array<Reservation>]
|
27
27
|
def reservations_get(opts = {})
|
28
28
|
data, _status_code, _headers = reservations_get_with_http_info(opts)
|
@@ -32,7 +32,7 @@ module BillingApi
|
|
32
32
|
# List all Reservations.
|
33
33
|
# Retrieves all reservations associated with the authenticated account. All date & times are in UTC.
|
34
34
|
# @param [Hash] opts the optional parameters
|
35
|
-
# @option opts [
|
35
|
+
# @option opts [ReservationProductCategoryEnum] :product_category The product category
|
36
36
|
# @return [Array<(Array<Reservation>, Integer, Hash)>] Array<Reservation> data, response status code and response headers
|
37
37
|
def reservations_get_with_http_info(opts = {})
|
38
38
|
if @api_client.config.debugging
|
@@ -145,31 +145,31 @@ module BillingApi
|
|
145
145
|
|
146
146
|
# Disable auto-renewal for reservation by id.
|
147
147
|
# Disable auto-renewal for reservation by reservation id.
|
148
|
-
# @param
|
148
|
+
# @param id [String] Resource id.
|
149
149
|
# @param [Hash] opts the optional parameters
|
150
150
|
# @option opts [ReservationAutoRenewDisableRequest] :reservation_auto_renew_disable_request
|
151
151
|
# @return [Reservation]
|
152
|
-
def reservations_reservation_id_actions_auto_renew_disable_post(
|
153
|
-
data, _status_code, _headers = reservations_reservation_id_actions_auto_renew_disable_post_with_http_info(
|
152
|
+
def reservations_reservation_id_actions_auto_renew_disable_post(id, opts = {})
|
153
|
+
data, _status_code, _headers = reservations_reservation_id_actions_auto_renew_disable_post_with_http_info(id, opts)
|
154
154
|
data
|
155
155
|
end
|
156
156
|
|
157
157
|
# Disable auto-renewal for reservation by id.
|
158
158
|
# Disable auto-renewal for reservation by reservation id.
|
159
|
-
# @param
|
159
|
+
# @param id [String] Resource id.
|
160
160
|
# @param [Hash] opts the optional parameters
|
161
161
|
# @option opts [ReservationAutoRenewDisableRequest] :reservation_auto_renew_disable_request
|
162
162
|
# @return [Array<(Reservation, Integer, Hash)>] Reservation data, response status code and response headers
|
163
|
-
def reservations_reservation_id_actions_auto_renew_disable_post_with_http_info(
|
163
|
+
def reservations_reservation_id_actions_auto_renew_disable_post_with_http_info(id, opts = {})
|
164
164
|
if @api_client.config.debugging
|
165
165
|
@api_client.config.logger.debug 'Calling API: ReservationsApi.reservations_reservation_id_actions_auto_renew_disable_post ...'
|
166
166
|
end
|
167
|
-
# verify the required parameter '
|
168
|
-
if @api_client.config.client_side_validation &&
|
169
|
-
fail ArgumentError, "Missing the required parameter '
|
167
|
+
# verify the required parameter 'id' is set
|
168
|
+
if @api_client.config.client_side_validation && id.nil?
|
169
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ReservationsApi.reservations_reservation_id_actions_auto_renew_disable_post"
|
170
170
|
end
|
171
171
|
# resource path
|
172
|
-
local_var_path = '/reservations/{
|
172
|
+
local_var_path = '/reservations/{id}/actions/auto-renew/disable'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
173
173
|
|
174
174
|
# query parameters
|
175
175
|
query_params = opts[:query_params] || {}
|
@@ -215,29 +215,29 @@ module BillingApi
|
|
215
215
|
|
216
216
|
# Enable auto-renewal for unexpired reservation by reservation id.
|
217
217
|
# Enable auto-renewal for unexpired reservation by reservation id.
|
218
|
-
# @param
|
218
|
+
# @param id [String] Resource id.
|
219
219
|
# @param [Hash] opts the optional parameters
|
220
220
|
# @return [Reservation]
|
221
|
-
def reservations_reservation_id_actions_auto_renew_enable_post(
|
222
|
-
data, _status_code, _headers = reservations_reservation_id_actions_auto_renew_enable_post_with_http_info(
|
221
|
+
def reservations_reservation_id_actions_auto_renew_enable_post(id, opts = {})
|
222
|
+
data, _status_code, _headers = reservations_reservation_id_actions_auto_renew_enable_post_with_http_info(id, opts)
|
223
223
|
data
|
224
224
|
end
|
225
225
|
|
226
226
|
# Enable auto-renewal for unexpired reservation by reservation id.
|
227
227
|
# Enable auto-renewal for unexpired reservation by reservation id.
|
228
|
-
# @param
|
228
|
+
# @param id [String] Resource id.
|
229
229
|
# @param [Hash] opts the optional parameters
|
230
230
|
# @return [Array<(Reservation, Integer, Hash)>] Reservation data, response status code and response headers
|
231
|
-
def reservations_reservation_id_actions_auto_renew_enable_post_with_http_info(
|
231
|
+
def reservations_reservation_id_actions_auto_renew_enable_post_with_http_info(id, opts = {})
|
232
232
|
if @api_client.config.debugging
|
233
233
|
@api_client.config.logger.debug 'Calling API: ReservationsApi.reservations_reservation_id_actions_auto_renew_enable_post ...'
|
234
234
|
end
|
235
|
-
# verify the required parameter '
|
236
|
-
if @api_client.config.client_side_validation &&
|
237
|
-
fail ArgumentError, "Missing the required parameter '
|
235
|
+
# verify the required parameter 'id' is set
|
236
|
+
if @api_client.config.client_side_validation && id.nil?
|
237
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ReservationsApi.reservations_reservation_id_actions_auto_renew_enable_post"
|
238
238
|
end
|
239
239
|
# resource path
|
240
|
-
local_var_path = '/reservations/{
|
240
|
+
local_var_path = '/reservations/{id}/actions/auto-renew/enable'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
241
241
|
|
242
242
|
# query parameters
|
243
243
|
query_params = opts[:query_params] || {}
|
@@ -278,31 +278,31 @@ module BillingApi
|
|
278
278
|
|
279
279
|
# Convert reservation pricing model by reservation ID.
|
280
280
|
# Convert reservation pricing model by reservation id.
|
281
|
-
# @param
|
281
|
+
# @param id [String] Resource id.
|
282
282
|
# @param [Hash] opts the optional parameters
|
283
283
|
# @option opts [ReservationRequest] :reservation_request
|
284
284
|
# @return [Reservation]
|
285
|
-
def reservations_reservation_id_actions_convert_post(
|
286
|
-
data, _status_code, _headers = reservations_reservation_id_actions_convert_post_with_http_info(
|
285
|
+
def reservations_reservation_id_actions_convert_post(id, opts = {})
|
286
|
+
data, _status_code, _headers = reservations_reservation_id_actions_convert_post_with_http_info(id, opts)
|
287
287
|
data
|
288
288
|
end
|
289
289
|
|
290
290
|
# Convert reservation pricing model by reservation ID.
|
291
291
|
# Convert reservation pricing model by reservation id.
|
292
|
-
# @param
|
292
|
+
# @param id [String] Resource id.
|
293
293
|
# @param [Hash] opts the optional parameters
|
294
294
|
# @option opts [ReservationRequest] :reservation_request
|
295
295
|
# @return [Array<(Reservation, Integer, Hash)>] Reservation data, response status code and response headers
|
296
|
-
def reservations_reservation_id_actions_convert_post_with_http_info(
|
296
|
+
def reservations_reservation_id_actions_convert_post_with_http_info(id, opts = {})
|
297
297
|
if @api_client.config.debugging
|
298
298
|
@api_client.config.logger.debug 'Calling API: ReservationsApi.reservations_reservation_id_actions_convert_post ...'
|
299
299
|
end
|
300
|
-
# verify the required parameter '
|
301
|
-
if @api_client.config.client_side_validation &&
|
302
|
-
fail ArgumentError, "Missing the required parameter '
|
300
|
+
# verify the required parameter 'id' is set
|
301
|
+
if @api_client.config.client_side_validation && id.nil?
|
302
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ReservationsApi.reservations_reservation_id_actions_convert_post"
|
303
303
|
end
|
304
304
|
# resource path
|
305
|
-
local_var_path = '/reservations/{
|
305
|
+
local_var_path = '/reservations/{id}/actions/convert'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
306
306
|
|
307
307
|
# query parameters
|
308
308
|
query_params = opts[:query_params] || {}
|
@@ -348,29 +348,29 @@ module BillingApi
|
|
348
348
|
|
349
349
|
# Get a reservation.
|
350
350
|
# Retrieves the reservations with the specified identifier. All date & times are in UTC.
|
351
|
-
# @param
|
351
|
+
# @param id [String] Resource id.
|
352
352
|
# @param [Hash] opts the optional parameters
|
353
353
|
# @return [Reservation]
|
354
|
-
def reservations_reservation_id_get(
|
355
|
-
data, _status_code, _headers = reservations_reservation_id_get_with_http_info(
|
354
|
+
def reservations_reservation_id_get(id, opts = {})
|
355
|
+
data, _status_code, _headers = reservations_reservation_id_get_with_http_info(id, opts)
|
356
356
|
data
|
357
357
|
end
|
358
358
|
|
359
359
|
# Get a reservation.
|
360
360
|
# Retrieves the reservations with the specified identifier. All date & times are in UTC.
|
361
|
-
# @param
|
361
|
+
# @param id [String] Resource id.
|
362
362
|
# @param [Hash] opts the optional parameters
|
363
363
|
# @return [Array<(Reservation, Integer, Hash)>] Reservation data, response status code and response headers
|
364
|
-
def reservations_reservation_id_get_with_http_info(
|
364
|
+
def reservations_reservation_id_get_with_http_info(id, opts = {})
|
365
365
|
if @api_client.config.debugging
|
366
366
|
@api_client.config.logger.debug 'Calling API: ReservationsApi.reservations_reservation_id_get ...'
|
367
367
|
end
|
368
|
-
# verify the required parameter '
|
369
|
-
if @api_client.config.client_side_validation &&
|
370
|
-
fail ArgumentError, "Missing the required parameter '
|
368
|
+
# verify the required parameter 'id' is set
|
369
|
+
if @api_client.config.client_side_validation && id.nil?
|
370
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ReservationsApi.reservations_reservation_id_get"
|
371
371
|
end
|
372
372
|
# resource path
|
373
|
-
local_var_path = '/reservations/{
|
373
|
+
local_var_path = '/reservations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
374
374
|
|
375
375
|
# query parameters
|
376
376
|
query_params = opts[:query_params] || {}
|
@@ -33,8 +33,8 @@ module BillingApi
|
|
33
33
|
def initialize(config = Configuration.default)
|
34
34
|
@config = config
|
35
35
|
@config.params_encoding = :multi
|
36
|
-
@user_agent = "PNAP-ruby-sdk-bmc/#{ BillingApi::VERSION }"
|
37
|
-
@powered_by = "PNAP-ruby-sdk-bmc/#{ BillingApi::VERSION }"
|
36
|
+
@user_agent = "PNAP-ruby-sdk-bmc/BillingApi/#{ BillingApi::VERSION }"
|
37
|
+
@powered_by = "PNAP-ruby-sdk-bmc/BillingApi/#{ BillingApi::VERSION }"
|
38
38
|
@default_headers = {
|
39
39
|
'Content-Type' => 'application/json',
|
40
40
|
'User-Agent' => @user_agent,
|
@@ -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' => :'
|
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)
|
@@ -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
|
data/lib/pnap_billing_api.rb
CHANGED
@@ -27,6 +27,7 @@ require 'pnap_billing_api/models/location_availability_detail'
|
|
27
27
|
require 'pnap_billing_api/models/location_enum'
|
28
28
|
require 'pnap_billing_api/models/operating_system_details'
|
29
29
|
require 'pnap_billing_api/models/operating_system_record'
|
30
|
+
require 'pnap_billing_api/models/package_unit_enum'
|
30
31
|
require 'pnap_billing_api/models/price_unit_enum'
|
31
32
|
require 'pnap_billing_api/models/pricing_plan'
|
32
33
|
require 'pnap_billing_api/models/product'
|
@@ -41,6 +42,7 @@ require 'pnap_billing_api/models/reservation'
|
|
41
42
|
require 'pnap_billing_api/models/reservation_auto_renew_disable_request'
|
42
43
|
require 'pnap_billing_api/models/reservation_invoicing_model_enum'
|
43
44
|
require 'pnap_billing_api/models/reservation_model_enum'
|
45
|
+
require 'pnap_billing_api/models/reservation_product_category_enum'
|
44
46
|
require 'pnap_billing_api/models/reservation_request'
|
45
47
|
require 'pnap_billing_api/models/server_details'
|
46
48
|
require 'pnap_billing_api/models/server_product'
|
@@ -52,6 +54,7 @@ require 'pnap_billing_api/models/threshold_configuration_details'
|
|
52
54
|
|
53
55
|
# APIs
|
54
56
|
require 'pnap_billing_api/api/billing_configurations_api'
|
57
|
+
require 'pnap_billing_api/api/product_availability_api'
|
55
58
|
require 'pnap_billing_api/api/products_api'
|
56
59
|
require 'pnap_billing_api/api/rated_usage_api'
|
57
60
|
require 'pnap_billing_api/api/reservations_api'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
=begin
|
2
|
+
#Billing API
|
3
|
+
|
4
|
+
#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/phoenixnap-bare-metal-cloud-billing-models' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/billing/v1/)</b>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for BillingApi::ProductAvailabilityApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'ProductAvailabilityApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = BillingApi::ProductAvailabilityApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of ProductAvailabilityApi' do
|
30
|
+
it 'should create an instance of ProductAvailabilityApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(BillingApi::ProductAvailabilityApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for product_availability_get
|
36
|
+
# List all Product availabilities.
|
37
|
+
# Retrieves the list of product availability details.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @option opts [Array<String>] :product_category Product category. Currently only SERVER category is supported.
|
40
|
+
# @option opts [Array<String>] :product_code
|
41
|
+
# @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered.
|
42
|
+
# @option opts [Array<LocationEnum>] :location
|
43
|
+
# @option opts [Array<String>] :solution
|
44
|
+
# @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively.
|
45
|
+
# @return [Array<ProductAvailability>]
|
46
|
+
describe 'product_availability_get test' do
|
47
|
+
it 'should work' do
|
48
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -32,23 +32,6 @@ describe 'ProductsApi' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
# unit tests for product_availability_get
|
36
|
-
# List all Product availabilities.
|
37
|
-
# Retrieves the list of product availability details.
|
38
|
-
# @param [Hash] opts the optional parameters
|
39
|
-
# @option opts [Array<String>] :product_category Product category. Currently only SERVER category is supported.
|
40
|
-
# @option opts [Array<String>] :product_code
|
41
|
-
# @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered.
|
42
|
-
# @option opts [Array<LocationEnum>] :location
|
43
|
-
# @option opts [Array<String>] :solution
|
44
|
-
# @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively.
|
45
|
-
# @return [Array<ProductAvailability>]
|
46
|
-
describe 'product_availability_get test' do
|
47
|
-
it 'should work' do
|
48
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
35
|
# unit tests for products_get
|
53
36
|
# List all Products.
|
54
37
|
# Retrieves all Products.
|
@@ -36,7 +36,7 @@ describe 'ReservationsApi' do
|
|
36
36
|
# List all Reservations.
|
37
37
|
# Retrieves all reservations associated with the authenticated account. All date & times are in UTC.
|
38
38
|
# @param [Hash] opts the optional parameters
|
39
|
-
# @option opts [
|
39
|
+
# @option opts [ReservationProductCategoryEnum] :product_category The product category
|
40
40
|
# @return [Array<Reservation>]
|
41
41
|
describe 'reservations_get test' do
|
42
42
|
it 'should work' do
|
@@ -59,7 +59,7 @@ describe 'ReservationsApi' do
|
|
59
59
|
# unit tests for reservations_reservation_id_actions_auto_renew_disable_post
|
60
60
|
# Disable auto-renewal for reservation by id.
|
61
61
|
# Disable auto-renewal for reservation by reservation id.
|
62
|
-
# @param
|
62
|
+
# @param id Resource id.
|
63
63
|
# @param [Hash] opts the optional parameters
|
64
64
|
# @option opts [ReservationAutoRenewDisableRequest] :reservation_auto_renew_disable_request
|
65
65
|
# @return [Reservation]
|
@@ -72,7 +72,7 @@ describe 'ReservationsApi' do
|
|
72
72
|
# unit tests for reservations_reservation_id_actions_auto_renew_enable_post
|
73
73
|
# Enable auto-renewal for unexpired reservation by reservation id.
|
74
74
|
# Enable auto-renewal for unexpired reservation by reservation id.
|
75
|
-
# @param
|
75
|
+
# @param id Resource id.
|
76
76
|
# @param [Hash] opts the optional parameters
|
77
77
|
# @return [Reservation]
|
78
78
|
describe 'reservations_reservation_id_actions_auto_renew_enable_post test' do
|
@@ -84,7 +84,7 @@ describe 'ReservationsApi' do
|
|
84
84
|
# unit tests for reservations_reservation_id_actions_convert_post
|
85
85
|
# Convert reservation pricing model by reservation ID.
|
86
86
|
# Convert reservation pricing model by reservation id.
|
87
|
-
# @param
|
87
|
+
# @param id Resource id.
|
88
88
|
# @param [Hash] opts the optional parameters
|
89
89
|
# @option opts [ReservationRequest] :reservation_request
|
90
90
|
# @return [Reservation]
|
@@ -97,7 +97,7 @@ describe 'ReservationsApi' do
|
|
97
97
|
# unit tests for reservations_reservation_id_get
|
98
98
|
# Get a reservation.
|
99
99
|
# Retrieves the reservations with the specified identifier. All date & times are in UTC.
|
100
|
-
# @param
|
100
|
+
# @param id Resource id.
|
101
101
|
# @param [Hash] opts the optional parameters
|
102
102
|
# @return [Reservation]
|
103
103
|
describe 'reservations_reservation_id_get test' do
|
@@ -0,0 +1,30 @@
|
|
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::PackageUnitEnum
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe BillingApi::PackageUnitEnum do
|
21
|
+
let(:instance) { BillingApi::PackageUnitEnum.new }
|
22
|
+
|
23
|
+
describe 'test an instance of PackageUnitEnum' do
|
24
|
+
it 'should create an instance of PackageUnitEnum' do
|
25
|
+
# uncomment below to test the instance creation
|
26
|
+
#expect(instance).to be_instance_of(BillingApi::PackageUnitEnum)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -92,10 +92,6 @@ describe BillingApi::PricingPlan do
|
|
92
92
|
describe 'test attribute "package_unit"' do
|
93
93
|
it 'should work' do
|
94
94
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
95
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["GB", "TB"])
|
96
|
-
# validator.allowable_values.each do |value|
|
97
|
-
# expect { instance.package_unit = value }.not_to raise_error
|
98
|
-
# end
|
99
95
|
end
|
100
96
|
end
|
101
97
|
|