pnap_network_api 2.1.1 → 2.2.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/VERSION +1 -1
  4. data/docs/BgpIpPrefix.md +24 -0
  5. data/docs/BgpPeerGroup.md +6 -2
  6. data/docs/BgpPeerGroupCreate.md +1 -1
  7. data/docs/NetworkMembership.md +1 -1
  8. data/docs/PrivateNetworkCreate.md +1 -1
  9. data/docs/PublicNetwork.md +1 -1
  10. data/docs/PublicNetworkCreate.md +1 -1
  11. data/lib/pnap_network_api/api/bgp_peer_groups_api.rb +6 -6
  12. data/lib/pnap_network_api/api/private_networks_api.rb +6 -6
  13. data/lib/pnap_network_api/api/public_networks_api.rb +8 -8
  14. data/lib/pnap_network_api/api_client.rb +17 -14
  15. data/lib/pnap_network_api/api_error.rb +1 -1
  16. data/lib/pnap_network_api/api_model_base.rb +88 -0
  17. data/lib/pnap_network_api/configuration.rb +11 -1
  18. data/lib/pnap_network_api/models/asn_details.rb +41 -78
  19. data/lib/pnap_network_api/models/bgp_ip_prefix.rb +247 -0
  20. data/lib/pnap_network_api/models/bgp_ipv4_prefix.rb +52 -79
  21. data/lib/pnap_network_api/models/bgp_peer_group.rb +184 -83
  22. data/lib/pnap_network_api/models/bgp_peer_group_create.rb +44 -81
  23. data/lib/pnap_network_api/models/bgp_peer_group_patch.rb +13 -80
  24. data/lib/pnap_network_api/models/error.rb +21 -78
  25. data/lib/pnap_network_api/models/network_membership.rb +42 -79
  26. data/lib/pnap_network_api/models/private_network.rb +103 -80
  27. data/lib/pnap_network_api/models/private_network_create.rb +24 -81
  28. data/lib/pnap_network_api/models/private_network_modify.rb +23 -80
  29. data/lib/pnap_network_api/models/private_network_server.rb +31 -78
  30. data/lib/pnap_network_api/models/public_network.rb +84 -81
  31. data/lib/pnap_network_api/models/public_network_create.rb +24 -81
  32. data/lib/pnap_network_api/models/public_network_ip_block.rb +41 -78
  33. data/lib/pnap_network_api/models/public_network_ip_block_create.rb +21 -78
  34. data/lib/pnap_network_api/models/public_network_modify.rb +13 -80
  35. data/lib/pnap_network_api/version.rb +1 -2
  36. data/lib/pnap_network_api.rb +3 -1
  37. data/pnap_network_api.gemspec +6 -6
  38. data/spec/api/bgp_peer_groups_api_spec.rb +1 -1
  39. data/spec/api/private_networks_api_spec.rb +1 -1
  40. data/spec/api/public_networks_api_spec.rb +1 -1
  41. data/spec/models/asn_details_spec.rb +2 -2
  42. data/spec/models/bgp_ip_prefix_spec.rb +54 -0
  43. data/spec/models/bgp_ipv4_prefix_spec.rb +2 -2
  44. data/spec/models/bgp_peer_group_create_spec.rb +2 -2
  45. data/spec/models/bgp_peer_group_patch_spec.rb +2 -2
  46. data/spec/models/bgp_peer_group_spec.rb +14 -2
  47. data/spec/models/error_spec.rb +2 -2
  48. data/spec/models/network_membership_spec.rb +2 -2
  49. data/spec/models/private_network_create_spec.rb +2 -2
  50. data/spec/models/private_network_modify_spec.rb +2 -2
  51. data/spec/models/private_network_server_spec.rb +2 -2
  52. data/spec/models/private_network_spec.rb +2 -2
  53. data/spec/models/public_network_create_spec.rb +2 -2
  54. data/spec/models/public_network_ip_block_create_spec.rb +2 -2
  55. data/spec/models/public_network_ip_block_spec.rb +2 -2
  56. data/spec/models/public_network_modify_spec.rb +2 -2
  57. data/spec/models/public_network_spec.rb +2 -2
  58. data/spec/spec_helper.rb +1 -1
  59. metadata +29 -16
@@ -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 NetworkApi
17
17
  # Private Network details.
18
- class PrivateNetwork
18
+ class PrivateNetwork < ApiModelBase
19
19
  # The private network identifier.
20
20
  attr_accessor :id
21
21
 
@@ -69,9 +69,14 @@ module NetworkApi
69
69
  }
70
70
  end
71
71
 
72
+ # Returns attribute mapping this model knows about
73
+ def self.acceptable_attribute_map
74
+ attribute_map
75
+ end
76
+
72
77
  # Returns all the JSON keys this model knows about
73
78
  def self.acceptable_attributes
74
- attribute_map.values
79
+ acceptable_attribute_map.values
75
80
  end
76
81
 
77
82
  # Attribute type mapping.
@@ -106,9 +111,10 @@ module NetworkApi
106
111
  end
107
112
 
108
113
  # check to see if the attribute exists and convert string to symbol for hash key
114
+ acceptable_attribute_map = self.class.acceptable_attribute_map
109
115
  attributes = attributes.each_with_object({}) { |(k, v), h|
110
- if (!self.class.attribute_map.key?(k.to_sym))
111
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
116
+ if (!acceptable_attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetwork`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
112
118
  end
113
119
  h[k.to_sym] = v
114
120
  }
@@ -204,7 +210,7 @@ module NetworkApi
204
210
  end
205
211
 
206
212
  if @name.to_s.length < 1
207
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
213
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
208
214
  end
209
215
 
210
216
  if !@description.nil? && @description.to_s.length > 250
@@ -266,6 +272,16 @@ module NetworkApi
266
272
  true
267
273
  end
268
274
 
275
+ # Custom attribute writer method with validation
276
+ # @param [Object] id Value to be assigned
277
+ def id=(id)
278
+ if id.nil?
279
+ fail ArgumentError, 'id cannot be nil'
280
+ end
281
+
282
+ @id = id
283
+ end
284
+
269
285
  # Custom attribute writer method with validation
270
286
  # @param [Object] name Value to be assigned
271
287
  def name=(name)
@@ -278,7 +294,7 @@ module NetworkApi
278
294
  end
279
295
 
280
296
  if name.to_s.length < 1
281
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
297
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
282
298
  end
283
299
 
284
300
  @name = name
@@ -298,6 +314,86 @@ module NetworkApi
298
314
  @description = description
299
315
  end
300
316
 
317
+ # Custom attribute writer method with validation
318
+ # @param [Object] vlan_id Value to be assigned
319
+ def vlan_id=(vlan_id)
320
+ if vlan_id.nil?
321
+ fail ArgumentError, 'vlan_id cannot be nil'
322
+ end
323
+
324
+ @vlan_id = vlan_id
325
+ end
326
+
327
+ # Custom attribute writer method with validation
328
+ # @param [Object] type Value to be assigned
329
+ def type=(type)
330
+ if type.nil?
331
+ fail ArgumentError, 'type cannot be nil'
332
+ end
333
+
334
+ @type = type
335
+ end
336
+
337
+ # Custom attribute writer method with validation
338
+ # @param [Object] location Value to be assigned
339
+ def location=(location)
340
+ if location.nil?
341
+ fail ArgumentError, 'location cannot be nil'
342
+ end
343
+
344
+ @location = location
345
+ end
346
+
347
+ # Custom attribute writer method with validation
348
+ # @param [Object] location_default Value to be assigned
349
+ def location_default=(location_default)
350
+ if location_default.nil?
351
+ fail ArgumentError, 'location_default cannot be nil'
352
+ end
353
+
354
+ @location_default = location_default
355
+ end
356
+
357
+ # Custom attribute writer method with validation
358
+ # @param [Object] servers Value to be assigned
359
+ def servers=(servers)
360
+ if servers.nil?
361
+ fail ArgumentError, 'servers cannot be nil'
362
+ end
363
+
364
+ @servers = servers
365
+ end
366
+
367
+ # Custom attribute writer method with validation
368
+ # @param [Object] memberships Value to be assigned
369
+ def memberships=(memberships)
370
+ if memberships.nil?
371
+ fail ArgumentError, 'memberships cannot be nil'
372
+ end
373
+
374
+ @memberships = memberships
375
+ end
376
+
377
+ # Custom attribute writer method with validation
378
+ # @param [Object] status Value to be assigned
379
+ def status=(status)
380
+ if status.nil?
381
+ fail ArgumentError, 'status cannot be nil'
382
+ end
383
+
384
+ @status = status
385
+ end
386
+
387
+ # Custom attribute writer method with validation
388
+ # @param [Object] created_on Value to be assigned
389
+ def created_on=(created_on)
390
+ if created_on.nil?
391
+ fail ArgumentError, 'created_on cannot be nil'
392
+ end
393
+
394
+ @created_on = created_on
395
+ end
396
+
301
397
  # Checks equality by comparing each attribute.
302
398
  # @param [Object] Object to be compared
303
399
  def ==(o)
@@ -352,61 +448,6 @@ module NetworkApi
352
448
  new(transformed_hash)
353
449
  end
354
450
 
355
- # Deserializes the data based on type
356
- # @param string type Data type
357
- # @param string value Value to be deserialized
358
- # @return [Object] Deserialized data
359
- def self._deserialize(type, value)
360
- case type.to_sym
361
- when :Time
362
- Time.parse(value)
363
- when :Date
364
- Date.parse(value)
365
- when :String
366
- value.to_s
367
- when :Integer
368
- value.to_i
369
- when :Float
370
- value.to_f
371
- when :Boolean
372
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
373
- true
374
- else
375
- false
376
- end
377
- when :Object
378
- # generic object (usually a Hash), return directly
379
- value
380
- when /\AArray<(?<inner_type>.+)>\z/
381
- inner_type = Regexp.last_match[:inner_type]
382
- value.map { |v| _deserialize(inner_type, v) }
383
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
384
- k_type = Regexp.last_match[:k_type]
385
- v_type = Regexp.last_match[:v_type]
386
- {}.tap do |hash|
387
- value.each do |k, v|
388
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
389
- end
390
- end
391
- else # model
392
- # models (e.g. Pet) or oneOf
393
- klass = NetworkApi.const_get(type)
394
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
395
- end
396
- end
397
-
398
- # Returns the string representation of the object
399
- # @return [String] String presentation of the object
400
- def to_s
401
- to_hash.to_s
402
- end
403
-
404
- # to_body is an alias to to_hash (backward compatibility)
405
- # @return [Hash] Returns the object in the form of hash
406
- def to_body
407
- to_hash
408
- end
409
-
410
451
  # Returns the object in the form of hash
411
452
  # @return [Hash] Returns the object in the form of hash
412
453
  def to_hash
@@ -423,24 +464,6 @@ module NetworkApi
423
464
  hash
424
465
  end
425
466
 
426
- # Outputs non-array value in the form of hash
427
- # For object, use to_hash. Otherwise, just return the value
428
- # @param [Object] value Any valid value
429
- # @return [Hash] Returns the value in the form of hash
430
- def _to_hash(value)
431
- if value.is_a?(Array)
432
- value.compact.map { |v| _to_hash(v) }
433
- elsif value.is_a?(Hash)
434
- {}.tap do |hash|
435
- value.each { |k, v| hash[k] = _to_hash(v) }
436
- end
437
- elsif value.respond_to? :to_hash
438
- value.to_hash
439
- else
440
- value
441
- end
442
- end
443
-
444
467
  end
445
468
 
446
469
  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,14 +15,14 @@ require 'time'
15
15
 
16
16
  module NetworkApi
17
17
  # Details of Private Network to be created.
18
- class PrivateNetworkCreate
18
+ class PrivateNetworkCreate < ApiModelBase
19
19
  # The friendly name of this private network. This name should be unique.
20
20
  attr_accessor :name
21
21
 
22
22
  # The description of this private network.
23
23
  attr_accessor :description
24
24
 
25
- # The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`.
25
+ # The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`.
26
26
  attr_accessor :location
27
27
 
28
28
  # Identifies network as the default private network for the specified location.
@@ -46,9 +46,14 @@ module NetworkApi
46
46
  }
47
47
  end
48
48
 
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
49
54
  # Returns all the JSON keys this model knows about
50
55
  def self.acceptable_attributes
51
- attribute_map.values
56
+ acceptable_attribute_map.values
52
57
  end
53
58
 
54
59
  # Attribute type mapping.
@@ -77,9 +82,10 @@ module NetworkApi
77
82
  end
78
83
 
79
84
  # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
86
  attributes = attributes.each_with_object({}) { |(k, v), h|
81
- if (!self.class.attribute_map.key?(k.to_sym))
82
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
89
  end
84
90
  h[k.to_sym] = v
85
91
  }
@@ -129,7 +135,7 @@ module NetworkApi
129
135
  end
130
136
 
131
137
  if @name.to_s.length < 1
132
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
138
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
133
139
  end
134
140
 
135
141
  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
@@ -183,7 +189,7 @@ module NetworkApi
183
189
  end
184
190
 
185
191
  if name.to_s.length < 1
186
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
192
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
187
193
  end
188
194
 
189
195
  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
@@ -208,6 +214,16 @@ module NetworkApi
208
214
  @description = description
209
215
  end
210
216
 
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] location Value to be assigned
219
+ def location=(location)
220
+ if location.nil?
221
+ fail ArgumentError, 'location cannot be nil'
222
+ end
223
+
224
+ @location = location
225
+ end
226
+
211
227
  # Custom attribute writer method with validation
212
228
  # @param [Object] vlan_id Value to be assigned
213
229
  def vlan_id=(vlan_id)
@@ -274,61 +290,6 @@ module NetworkApi
274
290
  new(transformed_hash)
275
291
  end
276
292
 
277
- # Deserializes the data based on type
278
- # @param string type Data type
279
- # @param string value Value to be deserialized
280
- # @return [Object] Deserialized data
281
- def self._deserialize(type, value)
282
- case type.to_sym
283
- when :Time
284
- Time.parse(value)
285
- when :Date
286
- Date.parse(value)
287
- when :String
288
- value.to_s
289
- when :Integer
290
- value.to_i
291
- when :Float
292
- value.to_f
293
- when :Boolean
294
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
295
- true
296
- else
297
- false
298
- end
299
- when :Object
300
- # generic object (usually a Hash), return directly
301
- value
302
- when /\AArray<(?<inner_type>.+)>\z/
303
- inner_type = Regexp.last_match[:inner_type]
304
- value.map { |v| _deserialize(inner_type, v) }
305
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
306
- k_type = Regexp.last_match[:k_type]
307
- v_type = Regexp.last_match[:v_type]
308
- {}.tap do |hash|
309
- value.each do |k, v|
310
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
311
- end
312
- end
313
- else # model
314
- # models (e.g. Pet) or oneOf
315
- klass = NetworkApi.const_get(type)
316
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
317
- end
318
- end
319
-
320
- # Returns the string representation of the object
321
- # @return [String] String presentation of the object
322
- def to_s
323
- to_hash.to_s
324
- end
325
-
326
- # to_body is an alias to to_hash (backward compatibility)
327
- # @return [Hash] Returns the object in the form of hash
328
- def to_body
329
- to_hash
330
- end
331
-
332
293
  # Returns the object in the form of hash
333
294
  # @return [Hash] Returns the object in the form of hash
334
295
  def to_hash
@@ -345,24 +306,6 @@ module NetworkApi
345
306
  hash
346
307
  end
347
308
 
348
- # Outputs non-array value in the form of hash
349
- # For object, use to_hash. Otherwise, just return the value
350
- # @param [Object] value Any valid value
351
- # @return [Hash] Returns the value in the form of hash
352
- def _to_hash(value)
353
- if value.is_a?(Array)
354
- value.compact.map { |v| _to_hash(v) }
355
- elsif value.is_a?(Hash)
356
- {}.tap do |hash|
357
- value.each { |k, v| hash[k] = _to_hash(v) }
358
- end
359
- elsif value.respond_to? :to_hash
360
- value.to_hash
361
- else
362
- value
363
- end
364
- end
365
-
366
309
  end
367
310
 
368
311
  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 NetworkApi
17
17
  # Object including details to be modified in the Private Network.
18
- class PrivateNetworkModify
18
+ class PrivateNetworkModify < ApiModelBase
19
19
  # A friendly name given to the private network. This name should be unique.
20
20
  attr_accessor :name
21
21
 
@@ -34,9 +34,14 @@ module NetworkApi
34
34
  }
35
35
  end
36
36
 
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
37
42
  # Returns all the JSON keys this model knows about
38
43
  def self.acceptable_attributes
39
- attribute_map.values
44
+ acceptable_attribute_map.values
40
45
  end
41
46
 
42
47
  # Attribute type mapping.
@@ -62,9 +67,10 @@ module NetworkApi
62
67
  end
63
68
 
64
69
  # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
71
  attributes = attributes.each_with_object({}) { |(k, v), h|
66
- if (!self.class.attribute_map.key?(k.to_sym))
67
- fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkModify`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkModify`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
74
  end
69
75
  h[k.to_sym] = v
70
76
  }
@@ -100,7 +106,7 @@ module NetworkApi
100
106
  end
101
107
 
102
108
  if @name.to_s.length < 1
103
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
109
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
104
110
  end
105
111
 
106
112
  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
@@ -144,7 +150,7 @@ module NetworkApi
144
150
  end
145
151
 
146
152
  if name.to_s.length < 1
147
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
153
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
148
154
  end
149
155
 
150
156
  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
@@ -169,6 +175,16 @@ module NetworkApi
169
175
  @description = description
170
176
  end
171
177
 
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] location_default Value to be assigned
180
+ def location_default=(location_default)
181
+ if location_default.nil?
182
+ fail ArgumentError, 'location_default cannot be nil'
183
+ end
184
+
185
+ @location_default = location_default
186
+ end
187
+
172
188
  # Checks equality by comparing each attribute.
173
189
  # @param [Object] Object to be compared
174
190
  def ==(o)
@@ -214,61 +230,6 @@ module NetworkApi
214
230
  new(transformed_hash)
215
231
  end
216
232
 
217
- # Deserializes the data based on type
218
- # @param string type Data type
219
- # @param string value Value to be deserialized
220
- # @return [Object] Deserialized data
221
- def self._deserialize(type, value)
222
- case type.to_sym
223
- when :Time
224
- Time.parse(value)
225
- when :Date
226
- Date.parse(value)
227
- when :String
228
- value.to_s
229
- when :Integer
230
- value.to_i
231
- when :Float
232
- value.to_f
233
- when :Boolean
234
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
- true
236
- else
237
- false
238
- end
239
- when :Object
240
- # generic object (usually a Hash), return directly
241
- value
242
- when /\AArray<(?<inner_type>.+)>\z/
243
- inner_type = Regexp.last_match[:inner_type]
244
- value.map { |v| _deserialize(inner_type, v) }
245
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
- k_type = Regexp.last_match[:k_type]
247
- v_type = Regexp.last_match[:v_type]
248
- {}.tap do |hash|
249
- value.each do |k, v|
250
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
- end
252
- end
253
- else # model
254
- # models (e.g. Pet) or oneOf
255
- klass = NetworkApi.const_get(type)
256
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
257
- end
258
- end
259
-
260
- # Returns the string representation of the object
261
- # @return [String] String presentation of the object
262
- def to_s
263
- to_hash.to_s
264
- end
265
-
266
- # to_body is an alias to to_hash (backward compatibility)
267
- # @return [Hash] Returns the object in the form of hash
268
- def to_body
269
- to_hash
270
- end
271
-
272
233
  # Returns the object in the form of hash
273
234
  # @return [Hash] Returns the object in the form of hash
274
235
  def to_hash
@@ -285,24 +246,6 @@ module NetworkApi
285
246
  hash
286
247
  end
287
248
 
288
- # Outputs non-array value in the form of hash
289
- # For object, use to_hash. Otherwise, just return the value
290
- # @param [Object] value Any valid value
291
- # @return [Hash] Returns the value in the form of hash
292
- def _to_hash(value)
293
- if value.is_a?(Array)
294
- value.compact.map { |v| _to_hash(v) }
295
- elsif value.is_a?(Hash)
296
- {}.tap do |hash|
297
- value.each { |k, v| hash[k] = _to_hash(v) }
298
- end
299
- elsif value.respond_to? :to_hash
300
- value.to_hash
301
- else
302
- value
303
- end
304
- end
305
-
306
249
  end
307
250
 
308
251
  end