pnap_network_storage_api 2.0.4 → 2.0.5

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/pnap_network_storage_api/api/storage_networks_api.rb +12 -12
  4. data/lib/pnap_network_storage_api/api_client.rb +17 -14
  5. data/lib/pnap_network_storage_api/api_error.rb +1 -1
  6. data/lib/pnap_network_storage_api/api_model_base.rb +88 -0
  7. data/lib/pnap_network_storage_api/configuration.rb +11 -1
  8. data/lib/pnap_network_storage_api/models/error.rb +21 -78
  9. data/lib/pnap_network_storage_api/models/nfs_permissions.rb +11 -78
  10. data/lib/pnap_network_storage_api/models/nfs_permissions_create.rb +11 -78
  11. data/lib/pnap_network_storage_api/models/nfs_permissions_update.rb +11 -78
  12. data/lib/pnap_network_storage_api/models/permissions.rb +11 -78
  13. data/lib/pnap_network_storage_api/models/permissions_create.rb +11 -78
  14. data/lib/pnap_network_storage_api/models/permissions_update.rb +11 -78
  15. data/lib/pnap_network_storage_api/models/status.rb +1 -1
  16. data/lib/pnap_network_storage_api/models/storage_network.rb +11 -78
  17. data/lib/pnap_network_storage_api/models/storage_network_create.rb +23 -80
  18. data/lib/pnap_network_storage_api/models/storage_network_update.rb +13 -80
  19. data/lib/pnap_network_storage_api/models/storage_network_volume_create.rb +15 -82
  20. data/lib/pnap_network_storage_api/models/tag_assignment.rb +41 -78
  21. data/lib/pnap_network_storage_api/models/tag_assignment_request.rb +21 -78
  22. data/lib/pnap_network_storage_api/models/volume.rb +11 -78
  23. data/lib/pnap_network_storage_api/models/volume_create.rb +15 -82
  24. data/lib/pnap_network_storage_api/models/volume_update.rb +15 -82
  25. data/lib/pnap_network_storage_api/version.rb +1 -2
  26. data/lib/pnap_network_storage_api.rb +2 -1
  27. data/pnap_network_storage_api.gemspec +6 -6
  28. data/spec/api/storage_networks_api_spec.rb +1 -1
  29. data/spec/models/error_spec.rb +2 -2
  30. data/spec/models/nfs_permissions_create_spec.rb +2 -2
  31. data/spec/models/nfs_permissions_spec.rb +2 -2
  32. data/spec/models/nfs_permissions_update_spec.rb +2 -2
  33. data/spec/models/permissions_create_spec.rb +2 -2
  34. data/spec/models/permissions_spec.rb +2 -2
  35. data/spec/models/permissions_update_spec.rb +2 -2
  36. data/spec/models/status_spec.rb +2 -2
  37. data/spec/models/storage_network_create_spec.rb +2 -2
  38. data/spec/models/storage_network_spec.rb +2 -2
  39. data/spec/models/storage_network_update_spec.rb +2 -2
  40. data/spec/models/storage_network_volume_create_spec.rb +2 -2
  41. data/spec/models/tag_assignment_request_spec.rb +2 -2
  42. data/spec/models/tag_assignment_spec.rb +2 -2
  43. data/spec/models/volume_create_spec.rb +2 -2
  44. data/spec/models/volume_spec.rb +2 -2
  45. data/spec/models/volume_update_spec.rb +2 -2
  46. data/spec/spec_helper.rb +1 -1
  47. metadata +18 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0cb37fc8ff1e698c6590a1715c30aa3347c4a773f8fbd37646d7fdee07cc2f7
4
- data.tar.gz: 9a9eedd88587d2e1877c8b7745774beb274ad20120fe4aefa2b11cca6756d113
3
+ metadata.gz: 18b045ffad8fcfec4aadcbf43e50795a6a1666cd78e2289cb3a23e5fedf583ea
4
+ data.tar.gz: 8295c95066828802885dd4b4a10fca432e24e15e368d90713b532479fee2d79f
5
5
  SHA512:
6
- metadata.gz: 77df0c3c1b21f84ceb224444a7ae39dbf0f047ac4e17b3b5a83a8df10149926a5e363e29c0f4ec98fccc224cfa1a2a42b8143bcafd50f5b80fa603cf3bd88822
7
- data.tar.gz: 75cb0f5f013f13b58ea4012dbbf8e07b5ef5ed25d1f192d4653d7b1b249e799ca79800a2d9016c984bc09e7acc5b19d8bd748de217a02a50df1582a887cf6d12
6
+ metadata.gz: 92dc72c4dc9ab968269ffb229308ea79ad63228870f9cbacbef208155562d75c9d467d6dfcfcf63ba6c4e2a445c35ff426c8df93cd3135662f690e68d1cccd4d
7
+ data.tar.gz: bb8f21ebbf94474c0e09c3b956e81c2e60149826bf1568c2d12e50011d45e1c26398750a36058fe121719852e07b2318d925cca06666bec200c9ff09ea453ce5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.4
1
+ 2.0.5
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -48,7 +48,7 @@ module NetworkStorageApi
48
48
  # header parameters
49
49
  header_params = opts[:header_params] || {}
50
50
  # HTTP header 'Accept' (if needed)
51
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
52
52
 
53
53
  # form parameters
54
54
  form_params = opts[:form_params] || {}
@@ -111,7 +111,7 @@ module NetworkStorageApi
111
111
  # header parameters
112
112
  header_params = opts[:header_params] || {}
113
113
  # HTTP header 'Accept' (if needed)
114
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
115
115
 
116
116
  # form parameters
117
117
  form_params = opts[:form_params] || {}
@@ -174,7 +174,7 @@ module NetworkStorageApi
174
174
  # header parameters
175
175
  header_params = opts[:header_params] || {}
176
176
  # HTTP header 'Accept' (if needed)
177
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
177
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
178
178
 
179
179
  # form parameters
180
180
  form_params = opts[:form_params] || {}
@@ -243,7 +243,7 @@ module NetworkStorageApi
243
243
  # header parameters
244
244
  header_params = opts[:header_params] || {}
245
245
  # HTTP header 'Accept' (if needed)
246
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
246
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
247
247
  # HTTP header 'Content-Type'
248
248
  content_type = @api_client.select_header_content_type(['application/json'])
249
249
  if !content_type.nil?
@@ -311,7 +311,7 @@ module NetworkStorageApi
311
311
  # header parameters
312
312
  header_params = opts[:header_params] || {}
313
313
  # HTTP header 'Accept' (if needed)
314
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
314
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
315
315
  # HTTP header 'Content-Type'
316
316
  content_type = @api_client.select_header_content_type(['application/json'])
317
317
  if !content_type.nil?
@@ -382,7 +382,7 @@ module NetworkStorageApi
382
382
  # header parameters
383
383
  header_params = opts[:header_params] || {}
384
384
  # HTTP header 'Accept' (if needed)
385
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
385
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
386
386
 
387
387
  # form parameters
388
388
  form_params = opts[:form_params] || {}
@@ -451,7 +451,7 @@ module NetworkStorageApi
451
451
  # header parameters
452
452
  header_params = opts[:header_params] || {}
453
453
  # HTTP header 'Accept' (if needed)
454
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
454
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
455
455
  # HTTP header 'Content-Type'
456
456
  content_type = @api_client.select_header_content_type(['application/json'])
457
457
  if !content_type.nil?
@@ -525,7 +525,7 @@ module NetworkStorageApi
525
525
  # header parameters
526
526
  header_params = opts[:header_params] || {}
527
527
  # HTTP header 'Accept' (if needed)
528
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
528
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
529
529
 
530
530
  # form parameters
531
531
  form_params = opts[:form_params] || {}
@@ -594,7 +594,7 @@ module NetworkStorageApi
594
594
  # header parameters
595
595
  header_params = opts[:header_params] || {}
596
596
  # HTTP header 'Accept' (if needed)
597
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
597
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
598
598
 
599
599
  # form parameters
600
600
  form_params = opts[:form_params] || {}
@@ -669,7 +669,7 @@ module NetworkStorageApi
669
669
  # header parameters
670
670
  header_params = opts[:header_params] || {}
671
671
  # HTTP header 'Accept' (if needed)
672
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
672
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
673
673
  # HTTP header 'Content-Type'
674
674
  content_type = @api_client.select_header_content_type(['application/json'])
675
675
  if !content_type.nil?
@@ -749,7 +749,7 @@ module NetworkStorageApi
749
749
  # header parameters
750
750
  header_params = opts[:header_params] || {}
751
751
  # HTTP header 'Accept' (if needed)
752
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
752
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
753
753
  # HTTP header 'Content-Type'
754
754
  content_type = @api_client.select_header_content_type(['application/json'])
755
755
  if !content_type.nil?
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -52,7 +52,8 @@ module NetworkStorageApi
52
52
  # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
53
53
  def call_api(http_method, path, opts = {})
54
54
  request = build_request(http_method, path, opts)
55
- tempfile = download_file(request) if opts[:return_type] == 'File'
55
+ tempfile = nil
56
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
56
57
  response = request.run
57
58
 
58
59
  if @config.debugging
@@ -191,19 +192,17 @@ module NetworkStorageApi
191
192
  chunk.force_encoding(encoding)
192
193
  tempfile.write(chunk)
193
194
  end
194
- # run the request to ensure the tempfile is created successfully before returning it
195
- request.run
196
- if tempfile
195
+ request.on_complete do
196
+ if !tempfile
197
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
198
+ end
197
199
  tempfile.close
198
200
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
199
201
  "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
200
202
  "will be deleted automatically with GC. It's also recommended to delete the temp file "\
201
203
  "explicitly with `tempfile.delete`"
202
- else
203
- fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
204
+ yield tempfile if block_given?
204
205
  end
205
-
206
- tempfile
207
206
  end
208
207
 
209
208
  # Check if the given MIME is a JSON MIME.
@@ -215,7 +214,7 @@ module NetworkStorageApi
215
214
  # @param [String] mime MIME
216
215
  # @return [Boolean] True if the MIME is application/json
217
216
  def json_mime?(mime)
218
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
217
+ (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
219
218
  end
220
219
 
221
220
  # Deserialize the response to the given return type.
@@ -282,9 +281,13 @@ module NetworkStorageApi
282
281
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
283
282
  end
284
283
  else
285
- # models (e.g. Pet) or oneOf
284
+ # models (e.g. Pet) or oneOf/anyOf
286
285
  klass = NetworkStorageApi.const_get(return_type)
287
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
286
+ if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
287
+ klass.build(data)
288
+ else
289
+ klass.build_from_hash(data)
290
+ end
288
291
  end
289
292
  end
290
293
 
@@ -294,7 +297,7 @@ module NetworkStorageApi
294
297
  # @param [String] filename the filename to be sanitized
295
298
  # @return [String] the sanitized filename
296
299
  def sanitize_filename(filename)
297
- filename.gsub(/.*[\/\\]/, '')
300
+ filename.split(/[\/\\]/).last
298
301
  end
299
302
 
300
303
  def build_request_url(path, opts = {})
@@ -394,4 +397,4 @@ module NetworkStorageApi
394
397
  end
395
398
  end
396
399
  end
397
- end
400
+ 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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #Network Storage API
3
+
4
+ #Create, list, edit, and delete storage networks with the Network Storage API. Use storage networks to expand storage capacity on a private network. <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bare-metal-cloud-storage' target='_blank'>here</a> </span> <br> <b>All URLs are relative to (https://api.phoenixnap.com/network-storage/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.20.0
10
+
11
+ =end
12
+
13
+ module NetworkStorageApi
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = NetworkStorageApi.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ 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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module NetworkStorageApi
79
79
  # @return [true, false]
80
80
  attr_accessor :debugging
81
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
82
90
  # Defines the logger used for debugging.
83
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
92
  #
@@ -166,6 +174,7 @@ module NetworkStorageApi
166
174
  @timeout = 0
167
175
  @params_encoding = nil
168
176
  @debugging = false
177
+ @ignore_operation_servers = false
169
178
  @inject_format = false
170
179
  @force_ending_format = false
171
180
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -200,6 +209,7 @@ module NetworkStorageApi
200
209
 
201
210
  # Returns base URL for specified operation based on server settings
202
211
  def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
203
213
  if operation_server_settings.key?(operation) then
204
214
  index = server_operation_index.fetch(operation, server_index)
205
215
  server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module NetworkStorageApi
17
- class Error
17
+ class Error < ApiModelBase
18
18
  # The description detailing the cause of the error code.
19
19
  attr_accessor :message
20
20
 
@@ -29,9 +29,14 @@ module NetworkStorageApi
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -56,9 +61,10 @@ module NetworkStorageApi
56
61
  end
57
62
 
58
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -96,6 +102,16 @@ module NetworkStorageApi
96
102
  true
97
103
  end
98
104
 
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] message Value to be assigned
107
+ def message=(message)
108
+ if message.nil?
109
+ fail ArgumentError, 'message cannot be nil'
110
+ end
111
+
112
+ @message = message
113
+ end
114
+
99
115
  # Checks equality by comparing each attribute.
100
116
  # @param [Object] Object to be compared
101
117
  def ==(o)
@@ -140,61 +156,6 @@ module NetworkStorageApi
140
156
  new(transformed_hash)
141
157
  end
142
158
 
143
- # Deserializes the data based on type
144
- # @param string type Data type
145
- # @param string value Value to be deserialized
146
- # @return [Object] Deserialized data
147
- def self._deserialize(type, value)
148
- case type.to_sym
149
- when :Time
150
- Time.parse(value)
151
- when :Date
152
- Date.parse(value)
153
- when :String
154
- value.to_s
155
- when :Integer
156
- value.to_i
157
- when :Float
158
- value.to_f
159
- when :Boolean
160
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
- true
162
- else
163
- false
164
- end
165
- when :Object
166
- # generic object (usually a Hash), return directly
167
- value
168
- when /\AArray<(?<inner_type>.+)>\z/
169
- inner_type = Regexp.last_match[:inner_type]
170
- value.map { |v| _deserialize(inner_type, v) }
171
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
- k_type = Regexp.last_match[:k_type]
173
- v_type = Regexp.last_match[:v_type]
174
- {}.tap do |hash|
175
- value.each do |k, v|
176
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
- end
178
- end
179
- else # model
180
- # models (e.g. Pet) or oneOf
181
- klass = NetworkStorageApi.const_get(type)
182
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
- end
184
- end
185
-
186
- # Returns the string representation of the object
187
- # @return [String] String presentation of the object
188
- def to_s
189
- to_hash.to_s
190
- end
191
-
192
- # to_body is an alias to to_hash (backward compatibility)
193
- # @return [Hash] Returns the object in the form of hash
194
- def to_body
195
- to_hash
196
- end
197
-
198
159
  # Returns the object in the form of hash
199
160
  # @return [Hash] Returns the object in the form of hash
200
161
  def to_hash
@@ -211,24 +172,6 @@ module NetworkStorageApi
211
172
  hash
212
173
  end
213
174
 
214
- # Outputs non-array value in the form of hash
215
- # For object, use to_hash. Otherwise, just return the value
216
- # @param [Object] value Any valid value
217
- # @return [Hash] Returns the value in the form of hash
218
- def _to_hash(value)
219
- if value.is_a?(Array)
220
- value.compact.map { |v| _to_hash(v) }
221
- elsif value.is_a?(Hash)
222
- {}.tap do |hash|
223
- value.each { |k, v| hash[k] = _to_hash(v) }
224
- end
225
- elsif value.respond_to? :to_hash
226
- value.to_hash
227
- else
228
- value
229
- end
230
- end
231
-
232
175
  end
233
176
 
234
177
  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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module NetworkStorageApi
17
17
  # NFS specific permissions on a volume.
18
- class NfsPermissions
18
+ class NfsPermissions < ApiModelBase
19
19
  # Read/Write access.
20
20
  attr_accessor :read_write
21
21
 
@@ -42,9 +42,14 @@ module NetworkStorageApi
42
42
  }
43
43
  end
44
44
 
45
+ # Returns attribute mapping this model knows about
46
+ def self.acceptable_attribute_map
47
+ attribute_map
48
+ end
49
+
45
50
  # Returns all the JSON keys this model knows about
46
51
  def self.acceptable_attributes
47
- attribute_map.values
52
+ acceptable_attribute_map.values
48
53
  end
49
54
 
50
55
  # Attribute type mapping.
@@ -72,9 +77,10 @@ module NetworkStorageApi
72
77
  end
73
78
 
74
79
  # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
81
  attributes = attributes.each_with_object({}) { |(k, v), h|
76
- if (!self.class.attribute_map.key?(k.to_sym))
77
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::NfsPermissions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::NfsPermissions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
84
  end
79
85
  h[k.to_sym] = v
80
86
  }
@@ -172,61 +178,6 @@ module NetworkStorageApi
172
178
  new(transformed_hash)
173
179
  end
174
180
 
175
- # Deserializes the data based on type
176
- # @param string type Data type
177
- # @param string value Value to be deserialized
178
- # @return [Object] Deserialized data
179
- def self._deserialize(type, value)
180
- case type.to_sym
181
- when :Time
182
- Time.parse(value)
183
- when :Date
184
- Date.parse(value)
185
- when :String
186
- value.to_s
187
- when :Integer
188
- value.to_i
189
- when :Float
190
- value.to_f
191
- when :Boolean
192
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
- true
194
- else
195
- false
196
- end
197
- when :Object
198
- # generic object (usually a Hash), return directly
199
- value
200
- when /\AArray<(?<inner_type>.+)>\z/
201
- inner_type = Regexp.last_match[:inner_type]
202
- value.map { |v| _deserialize(inner_type, v) }
203
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
- k_type = Regexp.last_match[:k_type]
205
- v_type = Regexp.last_match[:v_type]
206
- {}.tap do |hash|
207
- value.each do |k, v|
208
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
- end
210
- end
211
- else # model
212
- # models (e.g. Pet) or oneOf
213
- klass = NetworkStorageApi.const_get(type)
214
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
- end
216
- end
217
-
218
- # Returns the string representation of the object
219
- # @return [String] String presentation of the object
220
- def to_s
221
- to_hash.to_s
222
- end
223
-
224
- # to_body is an alias to to_hash (backward compatibility)
225
- # @return [Hash] Returns the object in the form of hash
226
- def to_body
227
- to_hash
228
- end
229
-
230
181
  # Returns the object in the form of hash
231
182
  # @return [Hash] Returns the object in the form of hash
232
183
  def to_hash
@@ -243,24 +194,6 @@ module NetworkStorageApi
243
194
  hash
244
195
  end
245
196
 
246
- # Outputs non-array value in the form of hash
247
- # For object, use to_hash. Otherwise, just return the value
248
- # @param [Object] value Any valid value
249
- # @return [Hash] Returns the value in the form of hash
250
- def _to_hash(value)
251
- if value.is_a?(Array)
252
- value.compact.map { |v| _to_hash(v) }
253
- elsif value.is_a?(Hash)
254
- {}.tap do |hash|
255
- value.each { |k, v| hash[k] = _to_hash(v) }
256
- end
257
- elsif value.respond_to? :to_hash
258
- value.to_hash
259
- else
260
- value
261
- end
262
- end
263
-
264
197
  end
265
198
 
266
199
  end