pnap_bmc_api 1.5.0 → 2.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.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/VERSION +1 -1
  4. data/docs/DeleteResult.md +1 -1
  5. data/docs/OsConfigurationCloudInit.md +1 -1
  6. data/docs/QuotasApi.md +6 -8
  7. data/docs/SSHKeysApi.md +12 -16
  8. data/docs/Server.md +11 -7
  9. data/docs/ServerCreate.md +3 -3
  10. data/docs/ServerNetworkUpdate.md +2 -2
  11. data/docs/ServerPrivateNetwork.md +3 -3
  12. data/docs/ServerProvision.md +38 -0
  13. data/docs/ServerPublicNetwork.md +2 -2
  14. data/docs/ServersApi.md +173 -111
  15. data/docs/StorageConfigurationRootPartition.md +2 -2
  16. data/lib/pnap_bmc_api/api/quotas_api.rb +11 -7
  17. data/lib/pnap_bmc_api/api/servers_api.rb +200 -75
  18. data/lib/pnap_bmc_api/api/ssh_keys_api.rb +21 -13
  19. data/lib/pnap_bmc_api/api_client.rb +24 -21
  20. data/lib/pnap_bmc_api/api_error.rb +2 -1
  21. data/lib/pnap_bmc_api/configuration.rb +28 -9
  22. data/lib/pnap_bmc_api/models/action_result.rb +16 -19
  23. data/lib/pnap_bmc_api/models/delete_result.rb +18 -19
  24. data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +18 -19
  25. data/lib/pnap_bmc_api/models/error.rb +16 -19
  26. data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +19 -20
  27. data/lib/pnap_bmc_api/models/network_configuration.rb +14 -19
  28. data/lib/pnap_bmc_api/models/os_configuration.rb +19 -20
  29. data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +15 -20
  30. data/lib/pnap_bmc_api/models/os_configuration_map.rb +14 -19
  31. data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +19 -20
  32. data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +19 -20
  33. data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +14 -19
  34. data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +25 -22
  35. data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
  36. data/lib/pnap_bmc_api/models/private_network_configuration.rb +14 -19
  37. data/lib/pnap_bmc_api/models/public_network_configuration.rb +14 -19
  38. data/lib/pnap_bmc_api/models/quota.rb +30 -19
  39. data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +39 -19
  40. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +42 -21
  41. data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +14 -19
  42. data/lib/pnap_bmc_api/models/reset_result.rb +16 -19
  43. data/lib/pnap_bmc_api/models/server.rb +79 -33
  44. data/lib/pnap_bmc_api/models/server_create.rb +29 -22
  45. data/lib/pnap_bmc_api/models/server_ip_block.rb +16 -19
  46. data/lib/pnap_bmc_api/models/server_network_update.rb +15 -20
  47. data/lib/pnap_bmc_api/models/server_patch.rb +27 -24
  48. data/lib/pnap_bmc_api/models/server_private_network.rb +23 -22
  49. data/lib/pnap_bmc_api/models/server_provision.rb +395 -0
  50. data/lib/pnap_bmc_api/models/server_public_network.rb +17 -20
  51. data/lib/pnap_bmc_api/models/server_reserve.rb +16 -19
  52. data/lib/pnap_bmc_api/models/server_reset.rb +14 -19
  53. data/lib/pnap_bmc_api/models/ssh_key.rb +28 -19
  54. data/lib/pnap_bmc_api/models/ssh_key_create.rb +52 -19
  55. data/lib/pnap_bmc_api/models/ssh_key_update.rb +29 -19
  56. data/lib/pnap_bmc_api/models/storage_configuration.rb +14 -19
  57. data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +14 -19
  58. data/lib/pnap_bmc_api/models/tag_assignment.rb +20 -19
  59. data/lib/pnap_bmc_api/models/tag_assignment_request.rb +16 -19
  60. data/lib/pnap_bmc_api/version.rb +1 -1
  61. data/lib/pnap_bmc_api.rb +2 -2
  62. data/pnap_bmc_api.gemspec +2 -2
  63. data/spec/api/quotas_api_spec.rb +6 -6
  64. data/spec/api/servers_api_spec.rb +109 -36
  65. data/spec/api/ssh_keys_api_spec.rb +9 -9
  66. data/spec/models/action_result_spec.rb +6 -4
  67. data/spec/models/delete_result_spec.rb +7 -5
  68. data/spec/models/delete_ssh_key_result_spec.rb +7 -5
  69. data/spec/models/error_spec.rb +7 -5
  70. data/spec/models/ip_blocks_configuration_spec.rb +7 -5
  71. data/spec/models/network_configuration_spec.rb +19 -5
  72. data/spec/models/os_configuration_cloud_init_spec.rb +5 -3
  73. data/spec/models/os_configuration_map_esxi_spec.rb +8 -6
  74. data/spec/models/os_configuration_map_proxmox_spec.rb +8 -6
  75. data/spec/models/os_configuration_map_spec.rb +8 -6
  76. data/spec/models/os_configuration_netris_controller_spec.rb +7 -5
  77. data/spec/models/os_configuration_netris_softgate_spec.rb +8 -6
  78. data/spec/models/os_configuration_spec.rb +33 -7
  79. data/spec/models/os_configuration_windows_spec.rb +6 -4
  80. data/spec/models/private_network_configuration_spec.rb +8 -6
  81. data/spec/models/public_network_configuration_spec.rb +6 -4
  82. data/spec/models/quota_edit_limit_request_details_spec.rb +8 -6
  83. data/spec/models/quota_edit_limit_request_spec.rb +7 -5
  84. data/spec/models/quota_spec.rb +13 -15
  85. data/spec/models/relinquish_ip_block_spec.rb +6 -4
  86. data/spec/models/reset_result_spec.rb +8 -6
  87. data/spec/models/server_create_spec.rb +25 -17
  88. data/spec/models/server_ip_block_spec.rb +7 -5
  89. data/spec/models/server_network_update_spec.rb +5 -3
  90. data/spec/models/server_patch_spec.rb +7 -5
  91. data/spec/models/server_private_network_spec.rb +9 -7
  92. data/spec/models/server_provision_spec.rb +96 -0
  93. data/spec/models/server_public_network_spec.rb +8 -6
  94. data/spec/models/server_reserve_spec.rb +6 -4
  95. data/spec/models/server_reset_spec.rb +9 -7
  96. data/spec/models/server_spec.rb +47 -27
  97. data/spec/models/ssh_key_create_spec.rb +8 -6
  98. data/spec/models/ssh_key_spec.rb +12 -10
  99. data/spec/models/ssh_key_update_spec.rb +7 -5
  100. data/spec/models/storage_configuration_root_partition_spec.rb +6 -4
  101. data/spec/models/storage_configuration_spec.rb +5 -3
  102. data/spec/models/tag_assignment_request_spec.rb +7 -5
  103. data/spec/models/tag_assignment_spec.rb +10 -8
  104. data/spec/spec_helper.rb +1 -1
  105. metadata +38 -42
  106. data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
  107. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +0 -226
  108. data/spec/api_client_spec.rb +0 -226
  109. data/spec/configuration_spec.rb +0 -42
  110. data/spec/models/quota_edit_limit_request_details_all_of_spec.rb +0 -34
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnap_bmc_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhoenixNAP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-20 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -80,7 +80,6 @@ files:
80
80
  - docs/Quota.md
81
81
  - docs/QuotaEditLimitRequest.md
82
82
  - docs/QuotaEditLimitRequestDetails.md
83
- - docs/QuotaEditLimitRequestDetailsAllOf.md
84
83
  - docs/QuotasApi.md
85
84
  - docs/RelinquishIpBlock.md
86
85
  - docs/ResetResult.md
@@ -91,6 +90,7 @@ files:
91
90
  - docs/ServerNetworkUpdate.md
92
91
  - docs/ServerPatch.md
93
92
  - docs/ServerPrivateNetwork.md
93
+ - docs/ServerProvision.md
94
94
  - docs/ServerPublicNetwork.md
95
95
  - docs/ServerReserve.md
96
96
  - docs/ServerReset.md
@@ -128,7 +128,6 @@ files:
128
128
  - lib/pnap_bmc_api/models/quota.rb
129
129
  - lib/pnap_bmc_api/models/quota_edit_limit_request.rb
130
130
  - lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb
131
- - lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb
132
131
  - lib/pnap_bmc_api/models/relinquish_ip_block.rb
133
132
  - lib/pnap_bmc_api/models/reset_result.rb
134
133
  - lib/pnap_bmc_api/models/server.rb
@@ -137,6 +136,7 @@ files:
137
136
  - lib/pnap_bmc_api/models/server_network_update.rb
138
137
  - lib/pnap_bmc_api/models/server_patch.rb
139
138
  - lib/pnap_bmc_api/models/server_private_network.rb
139
+ - lib/pnap_bmc_api/models/server_provision.rb
140
140
  - lib/pnap_bmc_api/models/server_public_network.rb
141
141
  - lib/pnap_bmc_api/models/server_reserve.rb
142
142
  - lib/pnap_bmc_api/models/server_reset.rb
@@ -152,8 +152,6 @@ files:
152
152
  - spec/api/quotas_api_spec.rb
153
153
  - spec/api/servers_api_spec.rb
154
154
  - spec/api/ssh_keys_api_spec.rb
155
- - spec/api_client_spec.rb
156
- - spec/configuration_spec.rb
157
155
  - spec/models/action_result_spec.rb
158
156
  - spec/models/delete_result_spec.rb
159
157
  - spec/models/delete_ssh_key_result_spec.rb
@@ -170,7 +168,6 @@ files:
170
168
  - spec/models/os_configuration_windows_spec.rb
171
169
  - spec/models/private_network_configuration_spec.rb
172
170
  - spec/models/public_network_configuration_spec.rb
173
- - spec/models/quota_edit_limit_request_details_all_of_spec.rb
174
171
  - spec/models/quota_edit_limit_request_details_spec.rb
175
172
  - spec/models/quota_edit_limit_request_spec.rb
176
173
  - spec/models/quota_spec.rb
@@ -181,6 +178,7 @@ files:
181
178
  - spec/models/server_network_update_spec.rb
182
179
  - spec/models/server_patch_spec.rb
183
180
  - spec/models/server_private_network_spec.rb
181
+ - spec/models/server_provision_spec.rb
184
182
  - spec/models/server_public_network_spec.rb
185
183
  - spec/models/server_reserve_spec.rb
186
184
  - spec/models/server_reset_spec.rb
@@ -206,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
204
  requirements:
207
205
  - - ">="
208
206
  - !ruby/object:Gem::Version
209
- version: '2.4'
207
+ version: '2.7'
210
208
  required_rubygems_version: !ruby/object:Gem::Requirement
211
209
  requirements:
212
210
  - - ">="
@@ -218,47 +216,45 @@ signing_key:
218
216
  specification_version: 4
219
217
  summary: Bare Metal Cloud API Ruby Gem
220
218
  test_files:
221
- - spec/api/quotas_api_spec.rb
222
- - spec/api/servers_api_spec.rb
223
219
  - spec/api/ssh_keys_api_spec.rb
224
- - spec/api_client_spec.rb
225
- - spec/configuration_spec.rb
226
- - spec/models/action_result_spec.rb
227
- - spec/models/ssh_key_create_spec.rb
228
- - spec/models/ssh_key_update_spec.rb
229
- - spec/models/os_configuration_spec.rb
230
- - spec/models/os_configuration_netris_softgate_spec.rb
220
+ - spec/api/servers_api_spec.rb
221
+ - spec/api/quotas_api_spec.rb
222
+ - spec/models/public_network_configuration_spec.rb
223
+ - spec/models/quota_spec.rb
224
+ - spec/models/delete_ssh_key_result_spec.rb
225
+ - spec/models/error_spec.rb
226
+ - spec/models/ip_blocks_configuration_spec.rb
231
227
  - spec/models/server_network_update_spec.rb
228
+ - spec/models/network_configuration_spec.rb
229
+ - spec/models/server_spec.rb
230
+ - spec/models/tag_assignment_request_spec.rb
231
+ - spec/models/os_configuration_cloud_init_spec.rb
232
+ - spec/models/os_configuration_windows_spec.rb
233
+ - spec/models/delete_result_spec.rb
234
+ - spec/models/ssh_key_create_spec.rb
235
+ - spec/models/server_private_network_spec.rb
236
+ - spec/models/server_patch_spec.rb
237
+ - spec/models/storage_configuration_root_partition_spec.rb
232
238
  - spec/models/server_reset_spec.rb
239
+ - spec/models/server_ip_block_spec.rb
240
+ - spec/models/os_configuration_netris_softgate_spec.rb
233
241
  - spec/models/ssh_key_spec.rb
234
- - spec/models/os_configuration_cloud_init_spec.rb
235
- - spec/models/reset_result_spec.rb
236
- - spec/models/tag_assignment_request_spec.rb
237
- - spec/models/server_reserve_spec.rb
238
- - spec/models/os_configuration_netris_controller_spec.rb
239
- - spec/models/network_configuration_spec.rb
242
+ - spec/models/server_provision_spec.rb
240
243
  - spec/models/quota_edit_limit_request_spec.rb
241
- - spec/models/relinquish_ip_block_spec.rb
244
+ - spec/models/os_configuration_map_esxi_spec.rb
245
+ - spec/models/os_configuration_map_spec.rb
246
+ - spec/models/os_configuration_map_proxmox_spec.rb
242
247
  - spec/models/server_create_spec.rb
243
- - spec/models/delete_ssh_key_result_spec.rb
244
- - spec/models/error_spec.rb
248
+ - spec/models/tag_assignment_spec.rb
249
+ - spec/models/ssh_key_update_spec.rb
250
+ - spec/models/action_result_spec.rb
251
+ - spec/models/quota_edit_limit_request_details_spec.rb
252
+ - spec/models/os_configuration_netris_controller_spec.rb
253
+ - spec/models/reset_result_spec.rb
245
254
  - spec/models/private_network_configuration_spec.rb
246
- - spec/models/os_configuration_map_spec.rb
247
- - spec/models/quota_spec.rb
248
- - spec/models/server_private_network_spec.rb
255
+ - spec/models/server_reserve_spec.rb
249
256
  - spec/models/storage_configuration_spec.rb
250
- - spec/models/server_patch_spec.rb
251
- - spec/models/quota_edit_limit_request_details_spec.rb
252
- - spec/models/storage_configuration_root_partition_spec.rb
253
- - spec/models/public_network_configuration_spec.rb
254
- - spec/models/tag_assignment_spec.rb
255
- - spec/models/server_spec.rb
256
- - spec/models/os_configuration_windows_spec.rb
257
- - spec/models/quota_edit_limit_request_details_all_of_spec.rb
258
- - spec/models/os_configuration_map_esxi_spec.rb
259
- - spec/models/delete_result_spec.rb
260
- - spec/models/ip_blocks_configuration_spec.rb
261
- - spec/models/server_ip_block_spec.rb
257
+ - spec/models/os_configuration_spec.rb
258
+ - spec/models/relinquish_ip_block_spec.rb
262
259
  - spec/models/server_public_network_spec.rb
263
- - spec/models/os_configuration_map_proxmox_spec.rb
264
260
  - spec/spec_helper.rb
@@ -1,18 +0,0 @@
1
- # BmcApi::QuotaEditLimitRequestDetailsAllOf
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **requested_on** | **Time** | The point in time the request was submitted. | |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'pnap_bmc_api'
13
-
14
- instance = BmcApi::QuotaEditLimitRequestDetailsAllOf.new(
15
- requested_on: 2021-09-01T10:10:10Z
16
- )
17
- ```
18
-
@@ -1,226 +0,0 @@
1
- =begin
2
- #Bare Metal Cloud API
3
-
4
- #Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/how-to-deploy-bare-metal-cloud-server' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/bmc/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: 6.1.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module BmcApi
17
- # Pending quota modification requests yet to be reviewed.
18
- class QuotaEditLimitRequestDetailsAllOf
19
- # The point in time the request was submitted.
20
- attr_accessor :requested_on
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'requested_on' => :'requestedOn'
26
- }
27
- end
28
-
29
- # Returns all the JSON keys this model knows about
30
- def self.acceptable_attributes
31
- attribute_map.values
32
- end
33
-
34
- # Attribute type mapping.
35
- def self.openapi_types
36
- {
37
- :'requested_on' => :'Time'
38
- }
39
- end
40
-
41
- # List of attributes with nullable: true
42
- def self.openapi_nullable
43
- Set.new([
44
- ])
45
- end
46
-
47
- # Initializes the object
48
- # @param [Hash] attributes Model attributes in the form of hash
49
- def initialize(attributes = {})
50
- if (!attributes.is_a?(Hash))
51
- fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::QuotaEditLimitRequestDetailsAllOf` initialize method"
52
- end
53
-
54
- # check to see if the attribute exists and convert string to symbol for hash key
55
- attributes = attributes.each_with_object({}) { |(k, v), h|
56
- if (!self.class.attribute_map.key?(k.to_sym))
57
- fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::QuotaEditLimitRequestDetailsAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
- end
59
- h[k.to_sym] = v
60
- }
61
-
62
- if attributes.key?(:'requested_on')
63
- self.requested_on = attributes[:'requested_on']
64
- end
65
- end
66
-
67
- # Show invalid properties with the reasons. Usually used together with valid?
68
- # @return Array for valid properties with the reasons
69
- def list_invalid_properties
70
- invalid_properties = Array.new
71
- if @requested_on.nil?
72
- invalid_properties.push('invalid value for "requested_on", requested_on cannot be nil.')
73
- end
74
-
75
- invalid_properties
76
- end
77
-
78
- # Check to see if the all the properties in the model are valid
79
- # @return true if the model is valid
80
- def valid?
81
- return false if @requested_on.nil?
82
- true
83
- end
84
-
85
- # Checks equality by comparing each attribute.
86
- # @param [Object] Object to be compared
87
- def ==(o)
88
- return true if self.equal?(o)
89
- self.class == o.class &&
90
- requested_on == o.requested_on
91
- end
92
-
93
- # @see the `==` method
94
- # @param [Object] Object to be compared
95
- def eql?(o)
96
- self == o
97
- end
98
-
99
- # Calculates hash code according to all attributes.
100
- # @return [Integer] Hash code
101
- def hash
102
- [requested_on].hash
103
- end
104
-
105
- # Builds the object from hash
106
- # @param [Hash] attributes Model attributes in the form of hash
107
- # @return [Object] Returns the model itself
108
- def self.build_from_hash(attributes)
109
- new.build_from_hash(attributes)
110
- end
111
-
112
- # Builds the object from hash
113
- # @param [Hash] attributes Model attributes in the form of hash
114
- # @return [Object] Returns the model itself
115
- def build_from_hash(attributes)
116
- return nil unless attributes.is_a?(Hash)
117
- attributes = attributes.transform_keys(&:to_sym)
118
- self.class.openapi_types.each_pair do |key, type|
119
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
120
- self.send("#{key}=", nil)
121
- elsif type =~ /\AArray<(.*)>/i
122
- # check to ensure the input is an array given that the attribute
123
- # is documented as an array but the input is not
124
- if attributes[self.class.attribute_map[key]].is_a?(Array)
125
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
- end
127
- elsif !attributes[self.class.attribute_map[key]].nil?
128
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
- end
130
- end
131
-
132
- self
133
- end
134
-
135
- # Deserializes the data based on type
136
- # @param string type Data type
137
- # @param string value Value to be deserialized
138
- # @return [Object] Deserialized data
139
- def _deserialize(type, value)
140
- case type.to_sym
141
- when :Time
142
- Time.parse(value)
143
- when :Date
144
- Date.parse(value)
145
- when :String
146
- value.to_s
147
- when :Integer
148
- value.to_i
149
- when :Float
150
- value.to_f
151
- when :Boolean
152
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
- true
154
- else
155
- false
156
- end
157
- when :Object
158
- # generic object (usually a Hash), return directly
159
- value
160
- when /\AArray<(?<inner_type>.+)>\z/
161
- inner_type = Regexp.last_match[:inner_type]
162
- value.map { |v| _deserialize(inner_type, v) }
163
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
- k_type = Regexp.last_match[:k_type]
165
- v_type = Regexp.last_match[:v_type]
166
- {}.tap do |hash|
167
- value.each do |k, v|
168
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
- end
170
- end
171
- else # model
172
- # models (e.g. Pet) or oneOf
173
- klass = BmcApi.const_get(type)
174
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
175
- end
176
- end
177
-
178
- # Returns the string representation of the object
179
- # @return [String] String presentation of the object
180
- def to_s
181
- to_hash.to_s
182
- end
183
-
184
- # to_body is an alias to to_hash (backward compatibility)
185
- # @return [Hash] Returns the object in the form of hash
186
- def to_body
187
- to_hash
188
- end
189
-
190
- # Returns the object in the form of hash
191
- # @return [Hash] Returns the object in the form of hash
192
- def to_hash
193
- hash = {}
194
- self.class.attribute_map.each_pair do |attr, param|
195
- value = self.send(attr)
196
- if value.nil?
197
- is_nullable = self.class.openapi_nullable.include?(attr)
198
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
199
- end
200
-
201
- hash[param] = _to_hash(value)
202
- end
203
- hash
204
- end
205
-
206
- # Outputs non-array value in the form of hash
207
- # For object, use to_hash. Otherwise, just return the value
208
- # @param [Object] value Any valid value
209
- # @return [Hash] Returns the value in the form of hash
210
- def _to_hash(value)
211
- if value.is_a?(Array)
212
- value.compact.map { |v| _to_hash(v) }
213
- elsif value.is_a?(Hash)
214
- {}.tap do |hash|
215
- value.each { |k, v| hash[k] = _to_hash(v) }
216
- end
217
- elsif value.respond_to? :to_hash
218
- value.to_hash
219
- else
220
- value
221
- end
222
- end
223
-
224
- end
225
-
226
- end
@@ -1,226 +0,0 @@
1
- =begin
2
- #Bare Metal Cloud API
3
-
4
- #Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/how-to-deploy-bare-metal-cloud-server' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/bmc/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: 6.1.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe BmcApi::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- BmcApi.configure { |c| c.host = 'http://example.com' }
21
- expect(BmcApi::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- BmcApi.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(BmcApi::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- BmcApi.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(BmcApi::Configuration.default.host).to eq('hobo.com')
32
- end
33
- end
34
-
35
- context 'base_path' do
36
- it "prepends a slash to base_path" do
37
- BmcApi.configure { |c| c.base_path = 'v4/dog' }
38
- expect(BmcApi::Configuration.default.base_path).to eq('/v4/dog')
39
- end
40
-
41
- it "doesn't prepend a slash if one is already there" do
42
- BmcApi.configure { |c| c.base_path = '/v4/dog' }
43
- expect(BmcApi::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- BmcApi.configure { |c| c.base_path = nil }
48
- expect(BmcApi::Configuration.default.base_path).to eq('')
49
- end
50
- end
51
- end
52
- end
53
-
54
- describe 'params_encoding in #build_request' do
55
- let(:config) { BmcApi::Configuration.new }
56
- let(:api_client) { BmcApi::ApiClient.new(config) }
57
-
58
- it 'defaults to nil' do
59
- expect(BmcApi::Configuration.default.params_encoding).to eq(nil)
60
- expect(config.params_encoding).to eq(nil)
61
-
62
- request = api_client.build_request(:get, '/test')
63
- expect(request.options[:params_encoding]).to eq(nil)
64
- end
65
-
66
- it 'can be customized' do
67
- config.params_encoding = :multi
68
- request = api_client.build_request(:get, '/test')
69
- expect(request.options[:params_encoding]).to eq(:multi)
70
- end
71
- end
72
-
73
- describe 'timeout in #build_request' do
74
- let(:config) { BmcApi::Configuration.new }
75
- let(:api_client) { BmcApi::ApiClient.new(config) }
76
-
77
- it 'defaults to 0' do
78
- expect(BmcApi::Configuration.default.timeout).to eq(0)
79
- expect(config.timeout).to eq(0)
80
-
81
- request = api_client.build_request(:get, '/test')
82
- expect(request.options[:timeout]).to eq(0)
83
- end
84
-
85
- it 'can be customized' do
86
- config.timeout = 100
87
- request = api_client.build_request(:get, '/test')
88
- expect(request.options[:timeout]).to eq(100)
89
- end
90
- end
91
-
92
- describe '#deserialize' do
93
- it "handles Array<Integer>" do
94
- api_client = BmcApi::ApiClient.new
95
- headers = { 'Content-Type' => 'application/json' }
96
- response = double('response', headers: headers, body: '[12, 34]')
97
- data = api_client.deserialize(response, 'Array<Integer>')
98
- expect(data).to be_instance_of(Array)
99
- expect(data).to eq([12, 34])
100
- end
101
-
102
- it 'handles Array<Array<Integer>>' do
103
- api_client = BmcApi::ApiClient.new
104
- headers = { 'Content-Type' => 'application/json' }
105
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
- expect(data).to be_instance_of(Array)
108
- expect(data).to eq([[12, 34], [56]])
109
- end
110
-
111
- it 'handles Hash<String, String>' do
112
- api_client = BmcApi::ApiClient.new
113
- headers = { 'Content-Type' => 'application/json' }
114
- response = double('response', headers: headers, body: '{"message": "Hello"}')
115
- data = api_client.deserialize(response, 'Hash<String, String>')
116
- expect(data).to be_instance_of(Hash)
117
- expect(data).to eq(:message => 'Hello')
118
- end
119
- end
120
-
121
- describe "#object_to_hash" do
122
- it 'ignores nils and includes empty arrays' do
123
- # uncomment below to test object_to_hash for model
124
- # api_client = BmcApi::ApiClient.new
125
- # _model = BmcApi::ModelName.new
126
- # update the model attribute below
127
- # _model.id = 1
128
- # update the expected value (hash) below
129
- # expected = {id: 1, name: '', tags: []}
130
- # expect(api_client.object_to_hash(_model)).to eq(expected)
131
- end
132
- end
133
-
134
- describe '#build_collection_param' do
135
- let(:param) { ['aa', 'bb', 'cc'] }
136
- let(:api_client) { BmcApi::ApiClient.new }
137
-
138
- it 'works for csv' do
139
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
- end
141
-
142
- it 'works for ssv' do
143
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
- end
145
-
146
- it 'works for tsv' do
147
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
- end
149
-
150
- it 'works for pipes' do
151
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
- end
153
-
154
- it 'works for multi' do
155
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
- end
157
-
158
- it 'fails for invalid collection format' do
159
- expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
- end
161
- end
162
-
163
- describe '#json_mime?' do
164
- let(:api_client) { BmcApi::ApiClient.new }
165
-
166
- it 'works' do
167
- expect(api_client.json_mime?(nil)).to eq false
168
- expect(api_client.json_mime?('')).to eq false
169
-
170
- expect(api_client.json_mime?('application/json')).to eq true
171
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
-
174
- expect(api_client.json_mime?('application/xml')).to eq false
175
- expect(api_client.json_mime?('text/plain')).to eq false
176
- expect(api_client.json_mime?('application/jsonp')).to eq false
177
- end
178
- end
179
-
180
- describe '#select_header_accept' do
181
- let(:api_client) { BmcApi::ApiClient.new }
182
-
183
- it 'works' do
184
- expect(api_client.select_header_accept(nil)).to be_nil
185
- expect(api_client.select_header_accept([])).to be_nil
186
-
187
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
-
191
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
- end
194
- end
195
-
196
- describe '#select_header_content_type' do
197
- let(:api_client) { BmcApi::ApiClient.new }
198
-
199
- it 'works' do
200
- expect(api_client.select_header_content_type(nil)).to be_nil
201
- expect(api_client.select_header_content_type([])).to be_nil
202
-
203
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
- end
209
- end
210
-
211
- describe '#sanitize_filename' do
212
- let(:api_client) { BmcApi::ApiClient.new }
213
-
214
- it 'works' do
215
- expect(api_client.sanitize_filename('sun')).to eq('sun')
216
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
- end
225
- end
226
- end
@@ -1,42 +0,0 @@
1
- =begin
2
- #Bare Metal Cloud API
3
-
4
- #Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/how-to-deploy-bare-metal-cloud-server' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/bmc/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: 6.1.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe BmcApi::Configuration do
16
- let(:config) { BmcApi::Configuration.default }
17
-
18
- before(:each) do
19
- # uncomment below to setup host and base_path
20
- # require 'URI'
21
- # uri = URI.parse("https://api.phoenixnap.com/bmc/v1")
22
- # BmcApi.configure do |c|
23
- # c.host = uri.host
24
- # c.base_path = uri.path
25
- # end
26
- end
27
-
28
- describe '#base_url' do
29
- it 'should have the default value' do
30
- # uncomment below to test default value of the base path
31
- # expect(config.base_url).to eq("https://api.phoenixnap.com/bmc/v1")
32
- end
33
-
34
- it 'should remove trailing slashes' do
35
- [nil, '', '/', '//'].each do |base_path|
36
- config.base_path = base_path
37
- # uncomment below to test trailing slashes
38
- # expect(config.base_url).to eq("https://api.phoenixnap.com/bmc/v1")
39
- end
40
- end
41
- end
42
- end