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
@@ -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
  # Tag assigned to resource.
18
- class TagAssignment
18
+ class TagAssignment < ApiModelBase
19
19
  # The unique id of the tag.
20
20
  attr_accessor :id
21
21
 
@@ -64,9 +64,14 @@ module NetworkStorageApi
64
64
  }
65
65
  end
66
66
 
67
+ # Returns attribute mapping this model knows about
68
+ def self.acceptable_attribute_map
69
+ attribute_map
70
+ end
71
+
67
72
  # Returns all the JSON keys this model knows about
68
73
  def self.acceptable_attributes
69
- attribute_map.values
74
+ acceptable_attribute_map.values
70
75
  end
71
76
 
72
77
  # Attribute type mapping.
@@ -94,9 +99,10 @@ module NetworkStorageApi
94
99
  end
95
100
 
96
101
  # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
103
  attributes = attributes.each_with_object({}) { |(k, v), h|
98
- if (!self.class.attribute_map.key?(k.to_sym))
99
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
106
  end
101
107
  h[k.to_sym] = v
102
108
  }
@@ -160,6 +166,36 @@ module NetworkStorageApi
160
166
  true
161
167
  end
162
168
 
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] id Value to be assigned
171
+ def id=(id)
172
+ if id.nil?
173
+ fail ArgumentError, 'id cannot be nil'
174
+ end
175
+
176
+ @id = id
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] name Value to be assigned
181
+ def name=(name)
182
+ if name.nil?
183
+ fail ArgumentError, 'name cannot be nil'
184
+ end
185
+
186
+ @name = name
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] is_billing_tag Value to be assigned
191
+ def is_billing_tag=(is_billing_tag)
192
+ if is_billing_tag.nil?
193
+ fail ArgumentError, 'is_billing_tag cannot be nil'
194
+ end
195
+
196
+ @is_billing_tag = is_billing_tag
197
+ end
198
+
163
199
  # Custom attribute writer method checking allowed values (enum).
164
200
  # @param [Object] created_by Object to be assigned
165
201
  def created_by=(created_by)
@@ -217,61 +253,6 @@ module NetworkStorageApi
217
253
  new(transformed_hash)
218
254
  end
219
255
 
220
- # Deserializes the data based on type
221
- # @param string type Data type
222
- # @param string value Value to be deserialized
223
- # @return [Object] Deserialized data
224
- def self._deserialize(type, value)
225
- case type.to_sym
226
- when :Time
227
- Time.parse(value)
228
- when :Date
229
- Date.parse(value)
230
- when :String
231
- value.to_s
232
- when :Integer
233
- value.to_i
234
- when :Float
235
- value.to_f
236
- when :Boolean
237
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
- true
239
- else
240
- false
241
- end
242
- when :Object
243
- # generic object (usually a Hash), return directly
244
- value
245
- when /\AArray<(?<inner_type>.+)>\z/
246
- inner_type = Regexp.last_match[:inner_type]
247
- value.map { |v| _deserialize(inner_type, v) }
248
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
- k_type = Regexp.last_match[:k_type]
250
- v_type = Regexp.last_match[:v_type]
251
- {}.tap do |hash|
252
- value.each do |k, v|
253
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
- end
255
- end
256
- else # model
257
- # models (e.g. Pet) or oneOf
258
- klass = NetworkStorageApi.const_get(type)
259
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
260
- end
261
- end
262
-
263
- # Returns the string representation of the object
264
- # @return [String] String presentation of the object
265
- def to_s
266
- to_hash.to_s
267
- end
268
-
269
- # to_body is an alias to to_hash (backward compatibility)
270
- # @return [Hash] Returns the object in the form of hash
271
- def to_body
272
- to_hash
273
- end
274
-
275
256
  # Returns the object in the form of hash
276
257
  # @return [Hash] Returns the object in the form of hash
277
258
  def to_hash
@@ -288,24 +269,6 @@ module NetworkStorageApi
288
269
  hash
289
270
  end
290
271
 
291
- # Outputs non-array value in the form of hash
292
- # For object, use to_hash. Otherwise, just return the value
293
- # @param [Object] value Any valid value
294
- # @return [Hash] Returns the value in the form of hash
295
- def _to_hash(value)
296
- if value.is_a?(Array)
297
- value.compact.map { |v| _to_hash(v) }
298
- elsif value.is_a?(Hash)
299
- {}.tap do |hash|
300
- value.each { |k, v| hash[k] = _to_hash(v) }
301
- end
302
- elsif value.respond_to? :to_hash
303
- value.to_hash
304
- else
305
- value
306
- end
307
- end
308
-
309
272
  end
310
273
 
311
274
  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
  # Tag request to assign to resource.
18
- class TagAssignmentRequest
18
+ class TagAssignmentRequest < ApiModelBase
19
19
  # The name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100}.
20
20
  attr_accessor :name
21
21
 
@@ -30,9 +30,14 @@ module NetworkStorageApi
30
30
  }
31
31
  end
32
32
 
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
33
38
  # Returns all the JSON keys this model knows about
34
39
  def self.acceptable_attributes
35
- attribute_map.values
40
+ acceptable_attribute_map.values
36
41
  end
37
42
 
38
43
  # Attribute type mapping.
@@ -57,9 +62,10 @@ module NetworkStorageApi
57
62
  end
58
63
 
59
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
69
  end
64
70
  h[k.to_sym] = v
65
71
  }
@@ -95,6 +101,16 @@ module NetworkStorageApi
95
101
  true
96
102
  end
97
103
 
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] name Value to be assigned
106
+ def name=(name)
107
+ if name.nil?
108
+ fail ArgumentError, 'name cannot be nil'
109
+ end
110
+
111
+ @name = name
112
+ end
113
+
98
114
  # Checks equality by comparing each attribute.
99
115
  # @param [Object] Object to be compared
100
116
  def ==(o)
@@ -139,61 +155,6 @@ module NetworkStorageApi
139
155
  new(transformed_hash)
140
156
  end
141
157
 
142
- # Deserializes the data based on type
143
- # @param string type Data type
144
- # @param string value Value to be deserialized
145
- # @return [Object] Deserialized data
146
- def self._deserialize(type, value)
147
- case type.to_sym
148
- when :Time
149
- Time.parse(value)
150
- when :Date
151
- Date.parse(value)
152
- when :String
153
- value.to_s
154
- when :Integer
155
- value.to_i
156
- when :Float
157
- value.to_f
158
- when :Boolean
159
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
- true
161
- else
162
- false
163
- end
164
- when :Object
165
- # generic object (usually a Hash), return directly
166
- value
167
- when /\AArray<(?<inner_type>.+)>\z/
168
- inner_type = Regexp.last_match[:inner_type]
169
- value.map { |v| _deserialize(inner_type, v) }
170
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
- k_type = Regexp.last_match[:k_type]
172
- v_type = Regexp.last_match[:v_type]
173
- {}.tap do |hash|
174
- value.each do |k, v|
175
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
- end
177
- end
178
- else # model
179
- # models (e.g. Pet) or oneOf
180
- klass = NetworkStorageApi.const_get(type)
181
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
- end
183
- end
184
-
185
- # Returns the string representation of the object
186
- # @return [String] String presentation of the object
187
- def to_s
188
- to_hash.to_s
189
- end
190
-
191
- # to_body is an alias to to_hash (backward compatibility)
192
- # @return [Hash] Returns the object in the form of hash
193
- def to_body
194
- to_hash
195
- end
196
-
197
158
  # Returns the object in the form of hash
198
159
  # @return [Hash] Returns the object in the form of hash
199
160
  def to_hash
@@ -210,24 +171,6 @@ module NetworkStorageApi
210
171
  hash
211
172
  end
212
173
 
213
- # Outputs non-array value in the form of hash
214
- # For object, use to_hash. Otherwise, just return the value
215
- # @param [Object] value Any valid value
216
- # @return [Hash] Returns the value in the form of hash
217
- def _to_hash(value)
218
- if value.is_a?(Array)
219
- value.compact.map { |v| _to_hash(v) }
220
- elsif value.is_a?(Hash)
221
- {}.tap do |hash|
222
- value.each { |k, v| hash[k] = _to_hash(v) }
223
- end
224
- elsif value.respond_to? :to_hash
225
- value.to_hash
226
- else
227
- value
228
- end
229
- end
230
-
231
174
  end
232
175
 
233
176
  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
  # Volume for a storage network.
18
- class Volume
18
+ class Volume < ApiModelBase
19
19
  # Volume ID.
20
20
  attr_accessor :id
21
21
 
@@ -93,9 +93,14 @@ module NetworkStorageApi
93
93
  }
94
94
  end
95
95
 
96
+ # Returns attribute mapping this model knows about
97
+ def self.acceptable_attribute_map
98
+ attribute_map
99
+ end
100
+
96
101
  # Returns all the JSON keys this model knows about
97
102
  def self.acceptable_attributes
98
- attribute_map.values
103
+ acceptable_attribute_map.values
99
104
  end
100
105
 
101
106
  # Attribute type mapping.
@@ -131,9 +136,10 @@ module NetworkStorageApi
131
136
  end
132
137
 
133
138
  # check to see if the attribute exists and convert string to symbol for hash key
139
+ acceptable_attribute_map = self.class.acceptable_attribute_map
134
140
  attributes = attributes.each_with_object({}) { |(k, v), h|
135
- if (!self.class.attribute_map.key?(k.to_sym))
136
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Volume`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
141
+ if (!acceptable_attribute_map.key?(k.to_sym))
142
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Volume`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
137
143
  end
138
144
  h[k.to_sym] = v
139
145
  }
@@ -263,61 +269,6 @@ module NetworkStorageApi
263
269
  new(transformed_hash)
264
270
  end
265
271
 
266
- # Deserializes the data based on type
267
- # @param string type Data type
268
- # @param string value Value to be deserialized
269
- # @return [Object] Deserialized data
270
- def self._deserialize(type, value)
271
- case type.to_sym
272
- when :Time
273
- Time.parse(value)
274
- when :Date
275
- Date.parse(value)
276
- when :String
277
- value.to_s
278
- when :Integer
279
- value.to_i
280
- when :Float
281
- value.to_f
282
- when :Boolean
283
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
284
- true
285
- else
286
- false
287
- end
288
- when :Object
289
- # generic object (usually a Hash), return directly
290
- value
291
- when /\AArray<(?<inner_type>.+)>\z/
292
- inner_type = Regexp.last_match[:inner_type]
293
- value.map { |v| _deserialize(inner_type, v) }
294
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
295
- k_type = Regexp.last_match[:k_type]
296
- v_type = Regexp.last_match[:v_type]
297
- {}.tap do |hash|
298
- value.each do |k, v|
299
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
300
- end
301
- end
302
- else # model
303
- # models (e.g. Pet) or oneOf
304
- klass = NetworkStorageApi.const_get(type)
305
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
306
- end
307
- end
308
-
309
- # Returns the string representation of the object
310
- # @return [String] String presentation of the object
311
- def to_s
312
- to_hash.to_s
313
- end
314
-
315
- # to_body is an alias to to_hash (backward compatibility)
316
- # @return [Hash] Returns the object in the form of hash
317
- def to_body
318
- to_hash
319
- end
320
-
321
272
  # Returns the object in the form of hash
322
273
  # @return [Hash] Returns the object in the form of hash
323
274
  def to_hash
@@ -334,24 +285,6 @@ module NetworkStorageApi
334
285
  hash
335
286
  end
336
287
 
337
- # Outputs non-array value in the form of hash
338
- # For object, use to_hash. Otherwise, just return the value
339
- # @param [Object] value Any valid value
340
- # @return [Hash] Returns the value in the form of hash
341
- def _to_hash(value)
342
- if value.is_a?(Array)
343
- value.compact.map { |v| _to_hash(v) }
344
- elsif value.is_a?(Hash)
345
- {}.tap do |hash|
346
- value.each { |k, v| hash[k] = _to_hash(v) }
347
- end
348
- elsif value.respond_to? :to_hash
349
- value.to_hash
350
- else
351
- value
352
- end
353
- end
354
-
355
288
  end
356
289
 
357
290
  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
  # Create Volume.
18
- class VolumeCreate
18
+ class VolumeCreate < ApiModelBase
19
19
  # Volume friendly name.
20
20
  attr_accessor :name
21
21
 
@@ -45,9 +45,14 @@ module NetworkStorageApi
45
45
  }
46
46
  end
47
47
 
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
48
53
  # Returns all the JSON keys this model knows about
49
54
  def self.acceptable_attributes
50
- attribute_map.values
55
+ acceptable_attribute_map.values
51
56
  end
52
57
 
53
58
  # Attribute type mapping.
@@ -76,9 +81,10 @@ module NetworkStorageApi
76
81
  end
77
82
 
78
83
  # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
85
  attributes = attributes.each_with_object({}) { |(k, v), h|
80
- if (!self.class.attribute_map.key?(k.to_sym))
81
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::VolumeCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::VolumeCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
88
  end
83
89
  h[k.to_sym] = v
84
90
  }
@@ -128,7 +134,7 @@ module NetworkStorageApi
128
134
  end
129
135
 
130
136
  if @name.to_s.length < 1
131
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
137
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
132
138
  end
133
139
 
134
140
  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
@@ -145,7 +151,7 @@ module NetworkStorageApi
145
151
  end
146
152
 
147
153
  if !@path_suffix.nil? && @path_suffix.to_s.length < 0
148
- invalid_properties.push('invalid value for "path_suffix", the character length must be great than or equal to 0.')
154
+ invalid_properties.push('invalid value for "path_suffix", the character length must be greater than or equal to 0.')
149
155
  end
150
156
 
151
157
  pattern = Regexp.new(/^(\/[\w-]+)+$|^$/)
@@ -193,7 +199,7 @@ module NetworkStorageApi
193
199
  end
194
200
 
195
201
  if name.to_s.length < 1
196
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
202
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
197
203
  end
198
204
 
199
205
  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
@@ -230,7 +236,7 @@ module NetworkStorageApi
230
236
  end
231
237
 
232
238
  if path_suffix.to_s.length < 0
233
- fail ArgumentError, 'invalid value for "path_suffix", the character length must be great than or equal to 0.'
239
+ fail ArgumentError, 'invalid value for "path_suffix", the character length must be greater than or equal to 0.'
234
240
  end
235
241
 
236
242
  pattern = Regexp.new(/^(\/[\w-]+)+$|^$/)
@@ -303,61 +309,6 @@ module NetworkStorageApi
303
309
  new(transformed_hash)
304
310
  end
305
311
 
306
- # Deserializes the data based on type
307
- # @param string type Data type
308
- # @param string value Value to be deserialized
309
- # @return [Object] Deserialized data
310
- def self._deserialize(type, value)
311
- case type.to_sym
312
- when :Time
313
- Time.parse(value)
314
- when :Date
315
- Date.parse(value)
316
- when :String
317
- value.to_s
318
- when :Integer
319
- value.to_i
320
- when :Float
321
- value.to_f
322
- when :Boolean
323
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
324
- true
325
- else
326
- false
327
- end
328
- when :Object
329
- # generic object (usually a Hash), return directly
330
- value
331
- when /\AArray<(?<inner_type>.+)>\z/
332
- inner_type = Regexp.last_match[:inner_type]
333
- value.map { |v| _deserialize(inner_type, v) }
334
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
335
- k_type = Regexp.last_match[:k_type]
336
- v_type = Regexp.last_match[:v_type]
337
- {}.tap do |hash|
338
- value.each do |k, v|
339
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
340
- end
341
- end
342
- else # model
343
- # models (e.g. Pet) or oneOf
344
- klass = NetworkStorageApi.const_get(type)
345
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
346
- end
347
- end
348
-
349
- # Returns the string representation of the object
350
- # @return [String] String presentation of the object
351
- def to_s
352
- to_hash.to_s
353
- end
354
-
355
- # to_body is an alias to to_hash (backward compatibility)
356
- # @return [Hash] Returns the object in the form of hash
357
- def to_body
358
- to_hash
359
- end
360
-
361
312
  # Returns the object in the form of hash
362
313
  # @return [Hash] Returns the object in the form of hash
363
314
  def to_hash
@@ -374,24 +325,6 @@ module NetworkStorageApi
374
325
  hash
375
326
  end
376
327
 
377
- # Outputs non-array value in the form of hash
378
- # For object, use to_hash. Otherwise, just return the value
379
- # @param [Object] value Any valid value
380
- # @return [Hash] Returns the value in the form of hash
381
- def _to_hash(value)
382
- if value.is_a?(Array)
383
- value.compact.map { |v| _to_hash(v) }
384
- elsif value.is_a?(Hash)
385
- {}.tap do |hash|
386
- value.each { |k, v| hash[k] = _to_hash(v) }
387
- end
388
- elsif value.respond_to? :to_hash
389
- value.to_hash
390
- else
391
- value
392
- end
393
- end
394
-
395
328
  end
396
329
 
397
330
  end