pnap_billing_api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +187 -0
  4. data/Rakefile +10 -0
  5. data/VERSION +1 -0
  6. data/docs/ApplicableDiscounts.md +20 -0
  7. data/docs/BandwidthDetails.md +24 -0
  8. data/docs/BandwidthRecord.md +56 -0
  9. data/docs/BillingConfigurationsApi.md +74 -0
  10. data/docs/ConfigurationDetails.md +18 -0
  11. data/docs/DiscountDetails.md +22 -0
  12. data/docs/Error.md +20 -0
  13. data/docs/LocationAvailabilityDetail.md +26 -0
  14. data/docs/LocationEnum.md +15 -0
  15. data/docs/OperatingSystemDetails.md +20 -0
  16. data/docs/OperatingSystemRecord.md +56 -0
  17. data/docs/PriceUnitEnum.md +15 -0
  18. data/docs/PricingPlan.md +36 -0
  19. data/docs/Product.md +22 -0
  20. data/docs/ProductAvailability.md +22 -0
  21. data/docs/ProductCategoryEnum.md +15 -0
  22. data/docs/ProductsApi.md +167 -0
  23. data/docs/ProductsGet200ResponseInner.md +82 -0
  24. data/docs/PublicSubnetDetails.md +22 -0
  25. data/docs/PublicSubnetRecord.md +56 -0
  26. data/docs/RatedUsageApi.md +155 -0
  27. data/docs/RatedUsageGet200ResponseInner.md +88 -0
  28. data/docs/RatedUsageRecord.md +54 -0
  29. data/docs/Reservation.md +48 -0
  30. data/docs/ReservationAutoRenewDisableRequest.md +18 -0
  31. data/docs/ReservationInvoicingModelEnum.md +15 -0
  32. data/docs/ReservationModelEnum.md +15 -0
  33. data/docs/ReservationRequest.md +18 -0
  34. data/docs/ReservationsApi.md +439 -0
  35. data/docs/ServerDetails.md +20 -0
  36. data/docs/ServerProduct.md +24 -0
  37. data/docs/ServerProductMetadata.md +30 -0
  38. data/docs/ServerRecord.md +56 -0
  39. data/docs/StorageDetails.md +28 -0
  40. data/docs/StorageRecord.md +56 -0
  41. data/docs/ThresholdConfigurationDetails.md +18 -0
  42. data/lib/pnap_billing_api/api/billing_configurations_api.rb +79 -0
  43. data/lib/pnap_billing_api/api/products_api.rb +174 -0
  44. data/lib/pnap_billing_api/api/rated_usage_api.rb +156 -0
  45. data/lib/pnap_billing_api/api/reservations_api.rb +412 -0
  46. data/lib/pnap_billing_api/api_client.rb +397 -0
  47. data/lib/pnap_billing_api/api_error.rb +58 -0
  48. data/lib/pnap_billing_api/configuration.rb +298 -0
  49. data/lib/pnap_billing_api/models/applicable_discounts.rb +227 -0
  50. data/lib/pnap_billing_api/models/bandwidth_details.rb +294 -0
  51. data/lib/pnap_billing_api/models/bandwidth_record.rb +548 -0
  52. data/lib/pnap_billing_api/models/configuration_details.rb +215 -0
  53. data/lib/pnap_billing_api/models/discount_details.rb +291 -0
  54. data/lib/pnap_billing_api/models/error.rb +234 -0
  55. data/lib/pnap_billing_api/models/location_availability_detail.rb +314 -0
  56. data/lib/pnap_billing_api/models/location_enum.rb +45 -0
  57. data/lib/pnap_billing_api/models/operating_system_details.rb +240 -0
  58. data/lib/pnap_billing_api/models/operating_system_record.rb +548 -0
  59. data/lib/pnap_billing_api/models/price_unit_enum.rb +44 -0
  60. data/lib/pnap_billing_api/models/pricing_plan.rb +397 -0
  61. data/lib/pnap_billing_api/models/product.rb +252 -0
  62. data/lib/pnap_billing_api/models/product_availability.rb +258 -0
  63. data/lib/pnap_billing_api/models/product_category_enum.rb +43 -0
  64. data/lib/pnap_billing_api/models/products_get200_response_inner.rb +61 -0
  65. data/lib/pnap_billing_api/models/public_subnet_details.rb +250 -0
  66. data/lib/pnap_billing_api/models/public_subnet_record.rb +548 -0
  67. data/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb +64 -0
  68. data/lib/pnap_billing_api/models/rated_usage_record.rb +526 -0
  69. data/lib/pnap_billing_api/models/reservation.rb +466 -0
  70. data/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb +215 -0
  71. data/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb +40 -0
  72. data/lib/pnap_billing_api/models/reservation_model_enum.rb +43 -0
  73. data/lib/pnap_billing_api/models/reservation_request.rb +223 -0
  74. data/lib/pnap_billing_api/models/server_details.rb +240 -0
  75. data/lib/pnap_billing_api/models/server_product.rb +274 -0
  76. data/lib/pnap_billing_api/models/server_product_metadata.rb +325 -0
  77. data/lib/pnap_billing_api/models/server_record.rb +548 -0
  78. data/lib/pnap_billing_api/models/storage_details.rb +308 -0
  79. data/lib/pnap_billing_api/models/storage_record.rb +548 -0
  80. data/lib/pnap_billing_api/models/threshold_configuration_details.rb +223 -0
  81. data/lib/pnap_billing_api/version.rb +19 -0
  82. data/lib/pnap_billing_api.rb +75 -0
  83. data/pnap_billing_api.gemspec +39 -0
  84. data/spec/api/billing_configurations_api_spec.rb +46 -0
  85. data/spec/api/products_api_spec.rb +67 -0
  86. data/spec/api/rated_usage_api_spec.rb +61 -0
  87. data/spec/api/reservations_api_spec.rb +109 -0
  88. data/spec/models/applicable_discounts_spec.rb +42 -0
  89. data/spec/models/bandwidth_details_spec.rb +58 -0
  90. data/spec/models/bandwidth_record_spec.rb +154 -0
  91. data/spec/models/configuration_details_spec.rb +36 -0
  92. data/spec/models/discount_details_spec.rb +52 -0
  93. data/spec/models/error_spec.rb +42 -0
  94. data/spec/models/location_availability_detail_spec.rb +64 -0
  95. data/spec/models/location_enum_spec.rb +30 -0
  96. data/spec/models/operating_system_details_spec.rb +42 -0
  97. data/spec/models/operating_system_record_spec.rb +154 -0
  98. data/spec/models/price_unit_enum_spec.rb +30 -0
  99. data/spec/models/pricing_plan_spec.rb +102 -0
  100. data/spec/models/product_availability_spec.rb +48 -0
  101. data/spec/models/product_category_enum_spec.rb +30 -0
  102. data/spec/models/product_spec.rb +48 -0
  103. data/spec/models/products_get200_response_inner_spec.rb +44 -0
  104. data/spec/models/public_subnet_details_spec.rb +48 -0
  105. data/spec/models/public_subnet_record_spec.rb +154 -0
  106. data/spec/models/rated_usage_get200_response_inner_spec.rb +44 -0
  107. data/spec/models/rated_usage_record_spec.rb +148 -0
  108. data/spec/models/reservation_auto_renew_disable_request_spec.rb +36 -0
  109. data/spec/models/reservation_invoicing_model_enum_spec.rb +30 -0
  110. data/spec/models/reservation_model_enum_spec.rb +30 -0
  111. data/spec/models/reservation_request_spec.rb +36 -0
  112. data/spec/models/reservation_spec.rb +130 -0
  113. data/spec/models/server_details_spec.rb +42 -0
  114. data/spec/models/server_product_metadata_spec.rb +72 -0
  115. data/spec/models/server_product_spec.rb +54 -0
  116. data/spec/models/server_record_spec.rb +154 -0
  117. data/spec/models/storage_details_spec.rb +66 -0
  118. data/spec/models/storage_record_spec.rb +154 -0
  119. data/spec/models/threshold_configuration_details_spec.rb +36 -0
  120. data/spec/spec_helper.rb +111 -0
  121. metadata +240 -0
@@ -0,0 +1,28 @@
1
+ # BillingApi::StorageDetails
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **network_storage_id** | **String** | Network storage ID. | |
8
+ | **network_storage_name** | **String** | Network storage name. | |
9
+ | **volume_id** | **String** | Volume ID. | |
10
+ | **volume_name** | **String** | Volume name. | |
11
+ | **capacity_in_gb** | **Integer** | Capacity in GB. | |
12
+ | **created_on** | **Time** | Timestamp when the record was created. | |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'pnap_billing_api'
18
+
19
+ instance = BillingApi::StorageDetails.new(
20
+ network_storage_id: 123asd239-323las2d2-123123a,
21
+ network_storage_name: First network storage.,
22
+ volume_id: 123asd239-323las2d2-123123a,
23
+ volume_name: First volume.,
24
+ capacity_in_gb: 150000,
25
+ created_on: 2020-03-19T16:39Z
26
+ )
27
+ ```
28
+
@@ -0,0 +1,56 @@
1
+ # BillingApi::StorageRecord
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | The unique identifier of the rated usage record. | |
8
+ | **product_category** | **String** | The category of the product associated with this usage record. | |
9
+ | **product_code** | **String** | The code identifying the product associated to this usage record. | |
10
+ | **location** | [**LocationEnum**](LocationEnum.md) | | |
11
+ | **year_month** | **String** | Year and month of the usage record. | [optional] |
12
+ | **start_date_time** | **Time** | The point in time (in UTC) when usage has started. | |
13
+ | **end_date_time** | **Time** | The point in time (in UTC) until usage has been rated. | |
14
+ | **cost** | **Integer** | The rated usage in cents. | |
15
+ | **cost_before_discount** | **Integer** | The cost in cents before discount. | [optional] |
16
+ | **cost_description** | **String** | The rated usage cost description. | [optional] |
17
+ | **price_model** | **String** | The price model applied to this usage record. | |
18
+ | **unit_price** | **Float** | The unit price. | |
19
+ | **unit_price_description** | **String** | User friendly description of the unit price. | |
20
+ | **quantity** | **Float** | The number of units being charged. | |
21
+ | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | |
22
+ | **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | |
23
+ | **correlation_id** | **String** | Holds usage record id | |
24
+ | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] |
25
+ | **discount_details** | [**DiscountDetails**](DiscountDetails.md) | | [optional] |
26
+ | **metadata** | [**StorageDetails**](StorageDetails.md) | | |
27
+
28
+ ## Example
29
+
30
+ ```ruby
31
+ require 'pnap_billing_api'
32
+
33
+ instance = BillingApi::StorageRecord.new(
34
+ id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26,
35
+ product_category: bmc-server,
36
+ product_code: s1.c1.small,
37
+ location: null,
38
+ year_month: 2020-03,
39
+ start_date_time: 2020-03-19T16:39Z,
40
+ end_date_time: 2020-03-20T17:00Z,
41
+ cost: 384,
42
+ cost_before_discount: 15456,
43
+ cost_description: 24 Hour(s) @ $0.16 /Hour,
44
+ price_model: hourly,
45
+ unit_price: 0.16,
46
+ unit_price_description: per hour,
47
+ quantity: 24,
48
+ active: true,
49
+ usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26,
50
+ correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26,
51
+ reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04,
52
+ discount_details: null,
53
+ metadata: null
54
+ )
55
+ ```
56
+
@@ -0,0 +1,18 @@
1
+ # BillingApi::ThresholdConfigurationDetails
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **threshold_amount** | **Float** | Threshold billing amount. | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'pnap_billing_api'
13
+
14
+ instance = BillingApi::ThresholdConfigurationDetails.new(
15
+ threshold_amount: 100
16
+ )
17
+ ```
18
+
@@ -0,0 +1,79 @@
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 'cgi'
14
+
15
+ module BillingApi
16
+ class BillingConfigurationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Retrieves billing configuration associated with the authenticated account.
23
+ # Retrieves billing configuration associated with the authenticated account.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [ConfigurationDetails]
26
+ def account_billing_configuration_me_get(opts = {})
27
+ data, _status_code, _headers = account_billing_configuration_me_get_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Retrieves billing configuration associated with the authenticated account.
32
+ # Retrieves billing configuration associated with the authenticated account.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(ConfigurationDetails, Integer, Hash)>] ConfigurationDetails data, response status code and response headers
35
+ def account_billing_configuration_me_get_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: BillingConfigurationsApi.account_billing_configuration_me_get ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/account-billing-configurations/me'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'ConfigurationDetails'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"BillingConfigurationsApi.account_billing_configuration_me_get",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: BillingConfigurationsApi#account_billing_configuration_me_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,174 @@
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 'cgi'
14
+
15
+ module BillingApi
16
+ class ProductsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
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
+ # List all Products.
106
+ # Retrieves all Products.
107
+ # @param [Hash] opts the optional parameters
108
+ # @option opts [String] :product_code
109
+ # @option opts [String] :product_category
110
+ # @option opts [String] :sku_code
111
+ # @option opts [String] :location
112
+ # @return [Array<ProductsGet200ResponseInner>]
113
+ def products_get(opts = {})
114
+ data, _status_code, _headers = products_get_with_http_info(opts)
115
+ data
116
+ end
117
+
118
+ # List all Products.
119
+ # Retrieves all Products.
120
+ # @param [Hash] opts the optional parameters
121
+ # @option opts [String] :product_code
122
+ # @option opts [String] :product_category
123
+ # @option opts [String] :sku_code
124
+ # @option opts [String] :location
125
+ # @return [Array<(Array<ProductsGet200ResponseInner>, Integer, Hash)>] Array<ProductsGet200ResponseInner> data, response status code and response headers
126
+ def products_get_with_http_info(opts = {})
127
+ if @api_client.config.debugging
128
+ @api_client.config.logger.debug 'Calling API: ProductsApi.products_get ...'
129
+ end
130
+ # resource path
131
+ local_var_path = '/products'
132
+
133
+ # query parameters
134
+ query_params = opts[:query_params] || {}
135
+ query_params[:'productCode'] = opts[:'product_code'] if !opts[:'product_code'].nil?
136
+ query_params[:'productCategory'] = opts[:'product_category'] if !opts[:'product_category'].nil?
137
+ query_params[:'skuCode'] = opts[:'sku_code'] if !opts[:'sku_code'].nil?
138
+ query_params[:'location'] = opts[:'location'] if !opts[:'location'].nil?
139
+
140
+ # header parameters
141
+ header_params = opts[:header_params] || {}
142
+ # HTTP header 'Accept' (if needed)
143
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
144
+
145
+ # form parameters
146
+ form_params = opts[:form_params] || {}
147
+
148
+ # http body (model)
149
+ post_body = opts[:debug_body]
150
+
151
+ # return_type
152
+ return_type = opts[:debug_return_type] || 'Array<ProductsGet200ResponseInner>'
153
+
154
+ # auth_names
155
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
156
+
157
+ new_options = opts.merge(
158
+ :operation => :"ProductsApi.products_get",
159
+ :header_params => header_params,
160
+ :query_params => query_params,
161
+ :form_params => form_params,
162
+ :body => post_body,
163
+ :auth_names => auth_names,
164
+ :return_type => return_type
165
+ )
166
+
167
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug "API called: ProductsApi#products_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
170
+ end
171
+ return data, status_code, headers
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,156 @@
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 'cgi'
14
+
15
+ module BillingApi
16
+ class RatedUsageApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List the rated usage.
23
+ # Retrieves all rated usage for given time period. The information is presented as a list of rated usage records. Every record corresponds to a charge. All date & times are in UTC.
24
+ # @param from_year_month [String] From year month (inclusive) to filter rated usage records by.
25
+ # @param to_year_month [String] To year month (inclusive) to filter rated usage records by.
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [ProductCategoryEnum] :product_category The product category
28
+ # @return [Array<RatedUsageGet200ResponseInner>]
29
+ def rated_usage_get(from_year_month, to_year_month, opts = {})
30
+ data, _status_code, _headers = rated_usage_get_with_http_info(from_year_month, to_year_month, opts)
31
+ data
32
+ end
33
+
34
+ # List the rated usage.
35
+ # Retrieves all rated usage for given time period. The information is presented as a list of rated usage records. Every record corresponds to a charge. All date &amp; times are in UTC.
36
+ # @param from_year_month [String] From year month (inclusive) to filter rated usage records by.
37
+ # @param to_year_month [String] To year month (inclusive) to filter rated usage records by.
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [ProductCategoryEnum] :product_category The product category
40
+ # @return [Array<(Array<RatedUsageGet200ResponseInner>, Integer, Hash)>] Array<RatedUsageGet200ResponseInner> data, response status code and response headers
41
+ def rated_usage_get_with_http_info(from_year_month, to_year_month, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: RatedUsageApi.rated_usage_get ...'
44
+ end
45
+ # verify the required parameter 'from_year_month' is set
46
+ if @api_client.config.client_side_validation && from_year_month.nil?
47
+ fail ArgumentError, "Missing the required parameter 'from_year_month' when calling RatedUsageApi.rated_usage_get"
48
+ end
49
+ # verify the required parameter 'to_year_month' is set
50
+ if @api_client.config.client_side_validation && to_year_month.nil?
51
+ fail ArgumentError, "Missing the required parameter 'to_year_month' when calling RatedUsageApi.rated_usage_get"
52
+ end
53
+ # resource path
54
+ local_var_path = '/rated-usage'
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+ query_params[:'fromYearMonth'] = from_year_month
59
+ query_params[:'toYearMonth'] = to_year_month
60
+ query_params[:'productCategory'] = opts[:'product_category'] if !opts[:'product_category'].nil?
61
+
62
+ # header parameters
63
+ header_params = opts[:header_params] || {}
64
+ # HTTP header 'Accept' (if needed)
65
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body]
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'Array<RatedUsageGet200ResponseInner>'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"RatedUsageApi.rated_usage_get",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: RatedUsageApi#rated_usage_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # List the rated usage records for the current calendar month.
97
+ # Retrieves all rated usage for the current calendar month. The information is presented as a list of rated usage records. Every record corresponds to a charge. All date & times are in UTC.
98
+ # @param [Hash] opts the optional parameters
99
+ # @option opts [ProductCategoryEnum] :product_category The product category
100
+ # @return [Array<RatedUsageGet200ResponseInner>]
101
+ def rated_usage_month_to_date_get(opts = {})
102
+ data, _status_code, _headers = rated_usage_month_to_date_get_with_http_info(opts)
103
+ data
104
+ end
105
+
106
+ # List the rated usage records for the current calendar month.
107
+ # Retrieves all rated usage for the current calendar month. The information is presented as a list of rated usage records. Every record corresponds to a charge. All date &amp; times are in UTC.
108
+ # @param [Hash] opts the optional parameters
109
+ # @option opts [ProductCategoryEnum] :product_category The product category
110
+ # @return [Array<(Array<RatedUsageGet200ResponseInner>, Integer, Hash)>] Array<RatedUsageGet200ResponseInner> data, response status code and response headers
111
+ def rated_usage_month_to_date_get_with_http_info(opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: RatedUsageApi.rated_usage_month_to_date_get ...'
114
+ end
115
+ # resource path
116
+ local_var_path = '/rated-usage/month-to-date'
117
+
118
+ # query parameters
119
+ query_params = opts[:query_params] || {}
120
+ query_params[:'productCategory'] = opts[:'product_category'] if !opts[:'product_category'].nil?
121
+
122
+ # header parameters
123
+ header_params = opts[:header_params] || {}
124
+ # HTTP header 'Accept' (if needed)
125
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
126
+
127
+ # form parameters
128
+ form_params = opts[:form_params] || {}
129
+
130
+ # http body (model)
131
+ post_body = opts[:debug_body]
132
+
133
+ # return_type
134
+ return_type = opts[:debug_return_type] || 'Array<RatedUsageGet200ResponseInner>'
135
+
136
+ # auth_names
137
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
138
+
139
+ new_options = opts.merge(
140
+ :operation => :"RatedUsageApi.rated_usage_month_to_date_get",
141
+ :header_params => header_params,
142
+ :query_params => query_params,
143
+ :form_params => form_params,
144
+ :body => post_body,
145
+ :auth_names => auth_names,
146
+ :return_type => return_type
147
+ )
148
+
149
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug "API called: RatedUsageApi#rated_usage_month_to_date_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
+ end
153
+ return data, status_code, headers
154
+ end
155
+ end
156
+ end