pnap_network_storage_api 1.4.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -9
  3. data/VERSION +1 -1
  4. data/docs/StorageNetwork.md +2 -0
  5. data/docs/StorageNetworksApi.md +77 -87
  6. data/docs/Volume.md +2 -0
  7. data/lib/pnap_network_storage_api/api/storage_networks_api.rb +120 -100
  8. data/lib/pnap_network_storage_api/api_client.rb +24 -21
  9. data/lib/pnap_network_storage_api/api_error.rb +2 -1
  10. data/lib/pnap_network_storage_api/configuration.rb +28 -9
  11. data/lib/pnap_network_storage_api/models/error.rb +16 -19
  12. data/lib/pnap_network_storage_api/models/nfs_permissions.rb +14 -19
  13. data/lib/pnap_network_storage_api/models/nfs_permissions_create.rb +14 -19
  14. data/lib/pnap_network_storage_api/models/nfs_permissions_update.rb +14 -19
  15. data/lib/pnap_network_storage_api/models/permissions.rb +14 -19
  16. data/lib/pnap_network_storage_api/models/permissions_create.rb +14 -19
  17. data/lib/pnap_network_storage_api/models/permissions_update.rb +14 -19
  18. data/lib/pnap_network_storage_api/models/status.rb +8 -4
  19. data/lib/pnap_network_storage_api/models/storage_network.rb +47 -20
  20. data/lib/pnap_network_storage_api/models/storage_network_create.rb +42 -22
  21. data/lib/pnap_network_storage_api/models/storage_network_update.rb +36 -22
  22. data/lib/pnap_network_storage_api/models/storage_network_volume_create.rb +41 -23
  23. data/lib/pnap_network_storage_api/models/tag_assignment.rb +20 -19
  24. data/lib/pnap_network_storage_api/models/tag_assignment_request.rb +16 -19
  25. data/lib/pnap_network_storage_api/models/volume.rb +47 -20
  26. data/lib/pnap_network_storage_api/models/volume_create.rb +41 -23
  27. data/lib/pnap_network_storage_api/models/volume_update.rb +48 -26
  28. data/lib/pnap_network_storage_api/version.rb +1 -1
  29. data/lib/pnap_network_storage_api.rb +1 -1
  30. data/pnap_network_storage_api.gemspec +2 -2
  31. data/spec/api/storage_networks_api_spec.rb +70 -15
  32. data/spec/models/error_spec.rb +6 -4
  33. data/spec/models/nfs_permissions_create_spec.rb +9 -7
  34. data/spec/models/nfs_permissions_spec.rb +9 -7
  35. data/spec/models/nfs_permissions_update_spec.rb +9 -7
  36. data/spec/models/permissions_create_spec.rb +5 -3
  37. data/spec/models/permissions_spec.rb +5 -3
  38. data/spec/models/permissions_update_spec.rb +5 -3
  39. data/spec/models/status_spec.rb +4 -2
  40. data/spec/models/storage_network_create_spec.rb +14 -6
  41. data/spec/models/storage_network_spec.rb +19 -11
  42. data/spec/models/storage_network_update_spec.rb +6 -4
  43. data/spec/models/storage_network_volume_create_spec.rb +14 -6
  44. data/spec/models/tag_assignment_request_spec.rb +6 -4
  45. data/spec/models/tag_assignment_spec.rb +9 -7
  46. data/spec/models/volume_create_spec.rb +20 -6
  47. data/spec/models/volume_spec.rb +32 -12
  48. data/spec/models/volume_update_spec.rb +29 -3
  49. data/spec/spec_helper.rb +1 -1
  50. metadata +13 -17
  51. data/spec/api_client_spec.rb +0 -226
  52. data/spec/configuration_spec.rb +0 -42
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -62,6 +62,16 @@ module NetworkStorageApi
62
62
  # Defines the access token (Bearer) used with OAuth2.
63
63
  attr_accessor :access_token
64
64
 
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
65
75
  # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
66
76
  # details will be logged with `logger.debug` (see the `logger` attribute).
67
77
  # Default to false.
@@ -142,7 +152,7 @@ module NetworkStorageApi
142
152
  @scheme = 'https'
143
153
  @host = 'api.phoenixnap.com'
144
154
  @base_path = '/network-storage/v1'
145
- @server_index = 0
155
+ @server_index = nil
146
156
  @server_operation_index = {}
147
157
  @server_variables = {}
148
158
  @server_operation_variables = {}
@@ -190,10 +200,12 @@ module NetworkStorageApi
190
200
 
191
201
  # Returns base URL for specified operation based on server settings
192
202
  def base_url(operation = nil)
193
- index = server_operation_index.fetch(operation, server_index)
194
- return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
195
-
196
- server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
203
+ if operation_server_settings.key?(operation) then
204
+ index = server_operation_index.fetch(operation, server_index)
205
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
206
+ else
207
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
208
+ end
197
209
  end
198
210
 
199
211
  # Gets API key (with prefix if set).
@@ -208,6 +220,12 @@ module NetworkStorageApi
208
220
  end
209
221
  end
210
222
 
223
+ # Gets access_token using access_token_getter or uses the static access_token
224
+ def access_token_with_refresh
225
+ return access_token if access_token_getter.nil?
226
+ access_token_getter.call
227
+ end
228
+
211
229
  # Gets Basic Auth token string
212
230
  def basic_auth_token
213
231
  'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
@@ -221,7 +239,7 @@ module NetworkStorageApi
221
239
  type: 'oauth2',
222
240
  in: 'header',
223
241
  key: 'Authorization',
224
- value: "Bearer #{access_token}"
242
+ value: "Bearer #{access_token_with_refresh}"
225
243
  },
226
244
  }
227
245
  end
@@ -249,8 +267,8 @@ module NetworkStorageApi
249
267
  servers = server_settings if servers == nil
250
268
 
251
269
  # check array index out of bound
252
- if (index < 0 || index >= servers.size)
253
- fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
270
+ if (index.nil? || index < 0 || index >= servers.size)
271
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
254
272
  end
255
273
 
256
274
  server = servers[index]
@@ -275,5 +293,6 @@ module NetworkStorageApi
275
293
  url
276
294
  end
277
295
 
296
+
278
297
  end
279
298
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -65,6 +65,8 @@ module NetworkStorageApi
65
65
 
66
66
  if attributes.key?(:'message')
67
67
  self.message = attributes[:'message']
68
+ else
69
+ self.message = nil
68
70
  end
69
71
 
70
72
  if attributes.key?(:'validation_errors')
@@ -77,6 +79,7 @@ module NetworkStorageApi
77
79
  # Show invalid properties with the reasons. Usually used together with valid?
78
80
  # @return Array for valid properties with the reasons
79
81
  def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
83
  invalid_properties = Array.new
81
84
  if @message.nil?
82
85
  invalid_properties.push('invalid value for "message", message cannot be nil.')
@@ -88,6 +91,7 @@ module NetworkStorageApi
88
91
  # Check to see if the all the properties in the model are valid
89
92
  # @return true if the model is valid
90
93
  def valid?
94
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
95
  return false if @message.nil?
92
96
  true
93
97
  end
@@ -117,37 +121,30 @@ module NetworkStorageApi
117
121
  # @param [Hash] attributes Model attributes in the form of hash
118
122
  # @return [Object] Returns the model itself
119
123
  def self.build_from_hash(attributes)
120
- new.build_from_hash(attributes)
121
- end
122
-
123
- # Builds the object from hash
124
- # @param [Hash] attributes Model attributes in the form of hash
125
- # @return [Object] Returns the model itself
126
- def build_from_hash(attributes)
127
124
  return nil unless attributes.is_a?(Hash)
128
125
  attributes = attributes.transform_keys(&:to_sym)
129
- self.class.openapi_types.each_pair do |key, type|
130
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
- self.send("#{key}=", nil)
126
+ transformed_hash = {}
127
+ openapi_types.each_pair do |key, type|
128
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
129
+ transformed_hash["#{key}"] = nil
132
130
  elsif type =~ /\AArray<(.*)>/i
133
131
  # check to ensure the input is an array given that the attribute
134
132
  # is documented as an array but the input is not
135
- if attributes[self.class.attribute_map[key]].is_a?(Array)
136
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
133
+ if attributes[attribute_map[key]].is_a?(Array)
134
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
137
135
  end
138
- elsif !attributes[self.class.attribute_map[key]].nil?
139
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ elsif !attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
140
138
  end
141
139
  end
142
-
143
- self
140
+ new(transformed_hash)
144
141
  end
145
142
 
146
143
  # Deserializes the data based on type
147
144
  # @param string type Data type
148
145
  # @param string value Value to be deserialized
149
146
  # @return [Object] Deserialized data
150
- def _deserialize(type, value)
147
+ def self._deserialize(type, value)
151
148
  case type.to_sym
152
149
  when :Time
153
150
  Time.parse(value)
@@ -182,7 +179,7 @@ module NetworkStorageApi
182
179
  else # model
183
180
  # models (e.g. Pet) or oneOf
184
181
  klass = NetworkStorageApi.const_get(type)
185
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
183
  end
187
184
  end
188
185
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -113,6 +113,7 @@ module NetworkStorageApi
113
113
  # Show invalid properties with the reasons. Usually used together with valid?
114
114
  # @return Array for valid properties with the reasons
115
115
  def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
117
  invalid_properties = Array.new
117
118
  invalid_properties
118
119
  end
@@ -120,6 +121,7 @@ module NetworkStorageApi
120
121
  # Check to see if the all the properties in the model are valid
121
122
  # @return true if the model is valid
122
123
  def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
125
  true
124
126
  end
125
127
 
@@ -151,37 +153,30 @@ module NetworkStorageApi
151
153
  # @param [Hash] attributes Model attributes in the form of hash
152
154
  # @return [Object] Returns the model itself
153
155
  def self.build_from_hash(attributes)
154
- new.build_from_hash(attributes)
155
- end
156
-
157
- # Builds the object from hash
158
- # @param [Hash] attributes Model attributes in the form of hash
159
- # @return [Object] Returns the model itself
160
- def build_from_hash(attributes)
161
156
  return nil unless attributes.is_a?(Hash)
162
157
  attributes = attributes.transform_keys(&:to_sym)
163
- self.class.openapi_types.each_pair do |key, type|
164
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
165
- self.send("#{key}=", nil)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
166
162
  elsif type =~ /\AArray<(.*)>/i
167
163
  # check to ensure the input is an array given that the attribute
168
164
  # is documented as an array but the input is not
169
- if attributes[self.class.attribute_map[key]].is_a?(Array)
170
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
171
167
  end
172
- elsif !attributes[self.class.attribute_map[key]].nil?
173
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
174
170
  end
175
171
  end
176
-
177
- self
172
+ new(transformed_hash)
178
173
  end
179
174
 
180
175
  # Deserializes the data based on type
181
176
  # @param string type Data type
182
177
  # @param string value Value to be deserialized
183
178
  # @return [Object] Deserialized data
184
- def _deserialize(type, value)
179
+ def self._deserialize(type, value)
185
180
  case type.to_sym
186
181
  when :Time
187
182
  Time.parse(value)
@@ -216,7 +211,7 @@ module NetworkStorageApi
216
211
  else # model
217
212
  # models (e.g. Pet) or oneOf
218
213
  klass = NetworkStorageApi.const_get(type)
219
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
215
  end
221
216
  end
222
217
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -113,6 +113,7 @@ module NetworkStorageApi
113
113
  # Show invalid properties with the reasons. Usually used together with valid?
114
114
  # @return Array for valid properties with the reasons
115
115
  def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
117
  invalid_properties = Array.new
117
118
  invalid_properties
118
119
  end
@@ -120,6 +121,7 @@ module NetworkStorageApi
120
121
  # Check to see if the all the properties in the model are valid
121
122
  # @return true if the model is valid
122
123
  def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
125
  true
124
126
  end
125
127
 
@@ -151,37 +153,30 @@ module NetworkStorageApi
151
153
  # @param [Hash] attributes Model attributes in the form of hash
152
154
  # @return [Object] Returns the model itself
153
155
  def self.build_from_hash(attributes)
154
- new.build_from_hash(attributes)
155
- end
156
-
157
- # Builds the object from hash
158
- # @param [Hash] attributes Model attributes in the form of hash
159
- # @return [Object] Returns the model itself
160
- def build_from_hash(attributes)
161
156
  return nil unless attributes.is_a?(Hash)
162
157
  attributes = attributes.transform_keys(&:to_sym)
163
- self.class.openapi_types.each_pair do |key, type|
164
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
165
- self.send("#{key}=", nil)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
166
162
  elsif type =~ /\AArray<(.*)>/i
167
163
  # check to ensure the input is an array given that the attribute
168
164
  # is documented as an array but the input is not
169
- if attributes[self.class.attribute_map[key]].is_a?(Array)
170
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
171
167
  end
172
- elsif !attributes[self.class.attribute_map[key]].nil?
173
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
174
170
  end
175
171
  end
176
-
177
- self
172
+ new(transformed_hash)
178
173
  end
179
174
 
180
175
  # Deserializes the data based on type
181
176
  # @param string type Data type
182
177
  # @param string value Value to be deserialized
183
178
  # @return [Object] Deserialized data
184
- def _deserialize(type, value)
179
+ def self._deserialize(type, value)
185
180
  case type.to_sym
186
181
  when :Time
187
182
  Time.parse(value)
@@ -216,7 +211,7 @@ module NetworkStorageApi
216
211
  else # model
217
212
  # models (e.g. Pet) or oneOf
218
213
  klass = NetworkStorageApi.const_get(type)
219
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
215
  end
221
216
  end
222
217
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -113,6 +113,7 @@ module NetworkStorageApi
113
113
  # Show invalid properties with the reasons. Usually used together with valid?
114
114
  # @return Array for valid properties with the reasons
115
115
  def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
117
  invalid_properties = Array.new
117
118
  invalid_properties
118
119
  end
@@ -120,6 +121,7 @@ module NetworkStorageApi
120
121
  # Check to see if the all the properties in the model are valid
121
122
  # @return true if the model is valid
122
123
  def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
125
  true
124
126
  end
125
127
 
@@ -151,37 +153,30 @@ module NetworkStorageApi
151
153
  # @param [Hash] attributes Model attributes in the form of hash
152
154
  # @return [Object] Returns the model itself
153
155
  def self.build_from_hash(attributes)
154
- new.build_from_hash(attributes)
155
- end
156
-
157
- # Builds the object from hash
158
- # @param [Hash] attributes Model attributes in the form of hash
159
- # @return [Object] Returns the model itself
160
- def build_from_hash(attributes)
161
156
  return nil unless attributes.is_a?(Hash)
162
157
  attributes = attributes.transform_keys(&:to_sym)
163
- self.class.openapi_types.each_pair do |key, type|
164
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
165
- self.send("#{key}=", nil)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
166
162
  elsif type =~ /\AArray<(.*)>/i
167
163
  # check to ensure the input is an array given that the attribute
168
164
  # is documented as an array but the input is not
169
- if attributes[self.class.attribute_map[key]].is_a?(Array)
170
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
171
167
  end
172
- elsif !attributes[self.class.attribute_map[key]].nil?
173
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
174
170
  end
175
171
  end
176
-
177
- self
172
+ new(transformed_hash)
178
173
  end
179
174
 
180
175
  # Deserializes the data based on type
181
176
  # @param string type Data type
182
177
  # @param string value Value to be deserialized
183
178
  # @return [Object] Deserialized data
184
- def _deserialize(type, value)
179
+ def self._deserialize(type, value)
185
180
  case type.to_sym
186
181
  when :Time
187
182
  Time.parse(value)
@@ -216,7 +211,7 @@ module NetworkStorageApi
216
211
  else # model
217
212
  # models (e.g. Pet) or oneOf
218
213
  klass = NetworkStorageApi.const_get(type)
219
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
215
  end
221
216
  end
222
217
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -66,6 +66,7 @@ module NetworkStorageApi
66
66
  # Show invalid properties with the reasons. Usually used together with valid?
67
67
  # @return Array for valid properties with the reasons
68
68
  def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
70
  invalid_properties = Array.new
70
71
  invalid_properties
71
72
  end
@@ -73,6 +74,7 @@ module NetworkStorageApi
73
74
  # Check to see if the all the properties in the model are valid
74
75
  # @return true if the model is valid
75
76
  def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
76
78
  true
77
79
  end
78
80
 
@@ -100,37 +102,30 @@ module NetworkStorageApi
100
102
  # @param [Hash] attributes Model attributes in the form of hash
101
103
  # @return [Object] Returns the model itself
102
104
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
105
  return nil unless attributes.is_a?(Hash)
111
106
  attributes = attributes.transform_keys(&:to_sym)
112
- self.class.openapi_types.each_pair do |key, type|
113
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
- self.send("#{key}=", nil)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
115
111
  elsif type =~ /\AArray<(.*)>/i
116
112
  # check to ensure the input is an array given that the attribute
117
113
  # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
120
116
  end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
123
119
  end
124
120
  end
125
-
126
- self
121
+ new(transformed_hash)
127
122
  end
128
123
 
129
124
  # Deserializes the data based on type
130
125
  # @param string type Data type
131
126
  # @param string value Value to be deserialized
132
127
  # @return [Object] Deserialized data
133
- def _deserialize(type, value)
128
+ def self._deserialize(type, value)
134
129
  case type.to_sym
135
130
  when :Time
136
131
  Time.parse(value)
@@ -165,7 +160,7 @@ module NetworkStorageApi
165
160
  else # model
166
161
  # models (e.g. Pet) or oneOf
167
162
  klass = NetworkStorageApi.const_get(type)
168
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
164
  end
170
165
  end
171
166
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -66,6 +66,7 @@ module NetworkStorageApi
66
66
  # Show invalid properties with the reasons. Usually used together with valid?
67
67
  # @return Array for valid properties with the reasons
68
68
  def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
70
  invalid_properties = Array.new
70
71
  invalid_properties
71
72
  end
@@ -73,6 +74,7 @@ module NetworkStorageApi
73
74
  # Check to see if the all the properties in the model are valid
74
75
  # @return true if the model is valid
75
76
  def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
76
78
  true
77
79
  end
78
80
 
@@ -100,37 +102,30 @@ module NetworkStorageApi
100
102
  # @param [Hash] attributes Model attributes in the form of hash
101
103
  # @return [Object] Returns the model itself
102
104
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
105
  return nil unless attributes.is_a?(Hash)
111
106
  attributes = attributes.transform_keys(&:to_sym)
112
- self.class.openapi_types.each_pair do |key, type|
113
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
- self.send("#{key}=", nil)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
115
111
  elsif type =~ /\AArray<(.*)>/i
116
112
  # check to ensure the input is an array given that the attribute
117
113
  # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
120
116
  end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
123
119
  end
124
120
  end
125
-
126
- self
121
+ new(transformed_hash)
127
122
  end
128
123
 
129
124
  # Deserializes the data based on type
130
125
  # @param string type Data type
131
126
  # @param string value Value to be deserialized
132
127
  # @return [Object] Deserialized data
133
- def _deserialize(type, value)
128
+ def self._deserialize(type, value)
134
129
  case type.to_sym
135
130
  when :Time
136
131
  Time.parse(value)
@@ -165,7 +160,7 @@ module NetworkStorageApi
165
160
  else # model
166
161
  # models (e.g. Pet) or oneOf
167
162
  klass = NetworkStorageApi.const_get(type)
168
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
164
  end
170
165
  end
171
166
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -66,6 +66,7 @@ module NetworkStorageApi
66
66
  # Show invalid properties with the reasons. Usually used together with valid?
67
67
  # @return Array for valid properties with the reasons
68
68
  def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
70
  invalid_properties = Array.new
70
71
  invalid_properties
71
72
  end
@@ -73,6 +74,7 @@ module NetworkStorageApi
73
74
  # Check to see if the all the properties in the model are valid
74
75
  # @return true if the model is valid
75
76
  def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
76
78
  true
77
79
  end
78
80
 
@@ -100,37 +102,30 @@ module NetworkStorageApi
100
102
  # @param [Hash] attributes Model attributes in the form of hash
101
103
  # @return [Object] Returns the model itself
102
104
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
105
  return nil unless attributes.is_a?(Hash)
111
106
  attributes = attributes.transform_keys(&:to_sym)
112
- self.class.openapi_types.each_pair do |key, type|
113
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
- self.send("#{key}=", nil)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
115
111
  elsif type =~ /\AArray<(.*)>/i
116
112
  # check to ensure the input is an array given that the attribute
117
113
  # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
120
116
  end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
123
119
  end
124
120
  end
125
-
126
- self
121
+ new(transformed_hash)
127
122
  end
128
123
 
129
124
  # Deserializes the data based on type
130
125
  # @param string type Data type
131
126
  # @param string value Value to be deserialized
132
127
  # @return [Object] Deserialized data
133
- def _deserialize(type, value)
128
+ def self._deserialize(type, value)
134
129
  case type.to_sym
135
130
  when :Time
136
131
  Time.parse(value)
@@ -165,7 +160,7 @@ module NetworkStorageApi
165
160
  else # model
166
161
  # models (e.g. Pet) or oneOf
167
162
  klass = NetworkStorageApi.const_get(type)
168
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
164
  end
170
165
  end
171
166