ionoscloud-dbaas-mongo 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/LICENSE +201 -0
  5. data/README.md +58 -0
  6. data/Rakefile +10 -0
  7. data/docs/api/ClustersApi.md +313 -0
  8. data/docs/api/LogsApi.md +93 -0
  9. data/docs/api/MetadataApi.md +153 -0
  10. data/docs/api/RestoresApi.md +84 -0
  11. data/docs/api/SnapshotsApi.md +83 -0
  12. data/docs/api/TemplatesApi.md +80 -0
  13. data/docs/api/UsersApi.md +321 -0
  14. data/docs/models/APIVersion.md +20 -0
  15. data/docs/models/ClusterList.md +28 -0
  16. data/docs/models/ClusterListAllOf.md +22 -0
  17. data/docs/models/ClusterLogs.md +18 -0
  18. data/docs/models/ClusterLogsInstances.md +20 -0
  19. data/docs/models/ClusterLogsMessages.md +20 -0
  20. data/docs/models/ClusterProperties.md +32 -0
  21. data/docs/models/ClusterResponse.md +24 -0
  22. data/docs/models/Connection.md +22 -0
  23. data/docs/models/CreateClusterProperties.md +30 -0
  24. data/docs/models/CreateClusterRequest.md +20 -0
  25. data/docs/models/CreateRestoreRequest.md +18 -0
  26. data/docs/models/DayOfTheWeek.md +15 -0
  27. data/docs/models/ErrorMessage.md +20 -0
  28. data/docs/models/ErrorResponse.md +20 -0
  29. data/docs/models/MaintenanceWindow.md +20 -0
  30. data/docs/models/Metadata.md +30 -0
  31. data/docs/models/Pagination.md +22 -0
  32. data/docs/models/PaginationLinks.md +22 -0
  33. data/docs/models/ResourceType.md +15 -0
  34. data/docs/models/SnapshotList.md +28 -0
  35. data/docs/models/SnapshotListAllOf.md +22 -0
  36. data/docs/models/SnapshotProperties.md +22 -0
  37. data/docs/models/SnapshotResponse.md +22 -0
  38. data/docs/models/State.md +15 -0
  39. data/docs/models/TemplateList.md +18 -0
  40. data/docs/models/TemplateListAllOf.md +18 -0
  41. data/docs/models/TemplateResponse.md +24 -0
  42. data/docs/models/User.md +22 -0
  43. data/docs/models/UserMetadata.md +24 -0
  44. data/docs/models/UserProperties.md +24 -0
  45. data/docs/models/UserRoles.md +20 -0
  46. data/docs/models/UsersList.md +22 -0
  47. data/docs/summary.md +50 -0
  48. data/git_push.sh +56 -0
  49. data/ionoscloud-dbaas-mongo.gemspec +38 -0
  50. data/lib/ionoscloud-dbaas-mongo/api/clusters_api.rb +273 -0
  51. data/lib/ionoscloud-dbaas-mongo/api/logs_api.rb +109 -0
  52. data/lib/ionoscloud-dbaas-mongo/api/metadata_api.rb +136 -0
  53. data/lib/ionoscloud-dbaas-mongo/api/restores_api.rb +93 -0
  54. data/lib/ionoscloud-dbaas-mongo/api/snapshots_api.rb +85 -0
  55. data/lib/ionoscloud-dbaas-mongo/api/templates_api.rb +79 -0
  56. data/lib/ionoscloud-dbaas-mongo/api/users_api.rb +306 -0
  57. data/lib/ionoscloud-dbaas-mongo/api_client.rb +471 -0
  58. data/lib/ionoscloud-dbaas-mongo/api_error.rb +57 -0
  59. data/lib/ionoscloud-dbaas-mongo/configuration.rb +276 -0
  60. data/lib/ionoscloud-dbaas-mongo/models/api_version.rb +243 -0
  61. data/lib/ionoscloud-dbaas-mongo/models/cluster_list.rb +353 -0
  62. data/lib/ionoscloud-dbaas-mongo/models/cluster_list_all_of.rb +261 -0
  63. data/lib/ionoscloud-dbaas-mongo/models/cluster_logs.rb +227 -0
  64. data/lib/ionoscloud-dbaas-mongo/models/cluster_logs_instances.rb +244 -0
  65. data/lib/ionoscloud-dbaas-mongo/models/cluster_logs_messages.rb +243 -0
  66. data/lib/ionoscloud-dbaas-mongo/models/cluster_properties.rb +376 -0
  67. data/lib/ionoscloud-dbaas-mongo/models/cluster_response.rb +279 -0
  68. data/lib/ionoscloud-dbaas-mongo/models/connection.rb +279 -0
  69. data/lib/ionoscloud-dbaas-mongo/models/create_cluster_properties.rb +387 -0
  70. data/lib/ionoscloud-dbaas-mongo/models/create_cluster_request.rb +244 -0
  71. data/lib/ionoscloud-dbaas-mongo/models/create_restore_request.rb +233 -0
  72. data/lib/ionoscloud-dbaas-mongo/models/day_of_the_week.rb +42 -0
  73. data/lib/ionoscloud-dbaas-mongo/models/error_message.rb +245 -0
  74. data/lib/ionoscloud-dbaas-mongo/models/error_response.rb +244 -0
  75. data/lib/ionoscloud-dbaas-mongo/models/maintenance_window.rb +254 -0
  76. data/lib/ionoscloud-dbaas-mongo/models/metadata.rb +335 -0
  77. data/lib/ionoscloud-dbaas-mongo/models/pagination.rb +292 -0
  78. data/lib/ionoscloud-dbaas-mongo/models/pagination_links.rb +264 -0
  79. data/lib/ionoscloud-dbaas-mongo/models/resource_type.rb +38 -0
  80. data/lib/ionoscloud-dbaas-mongo/models/snapshot_list.rb +353 -0
  81. data/lib/ionoscloud-dbaas-mongo/models/snapshot_list_all_of.rb +261 -0
  82. data/lib/ionoscloud-dbaas-mongo/models/snapshot_properties.rb +264 -0
  83. data/lib/ionoscloud-dbaas-mongo/models/snapshot_response.rb +262 -0
  84. data/lib/ionoscloud-dbaas-mongo/models/state.rb +40 -0
  85. data/lib/ionoscloud-dbaas-mongo/models/template_list.rb +234 -0
  86. data/lib/ionoscloud-dbaas-mongo/models/template_list_all_of.rb +226 -0
  87. data/lib/ionoscloud-dbaas-mongo/models/template_response.rb +282 -0
  88. data/lib/ionoscloud-dbaas-mongo/models/user.rb +261 -0
  89. data/lib/ionoscloud-dbaas-mongo/models/user_metadata.rb +316 -0
  90. data/lib/ionoscloud-dbaas-mongo/models/user_properties.rb +294 -0
  91. data/lib/ionoscloud-dbaas-mongo/models/user_roles.rb +278 -0
  92. data/lib/ionoscloud-dbaas-mongo/models/users_list.rb +262 -0
  93. data/lib/ionoscloud-dbaas-mongo/version.rb +15 -0
  94. data/lib/ionoscloud-dbaas-mongo.rb +79 -0
  95. data/spec/api_client_spec.rb +226 -0
  96. data/spec/configuration_spec.rb +42 -0
  97. data/spec/spec_helper.rb +111 -0
  98. metadata +189 -0
@@ -0,0 +1,353 @@
1
+ =begin
2
+ #IONOS DBaaS MongoDB REST API
3
+
4
+ #With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups and users via the API. MongoDB is an open source, cross-platform, document-oriented database program. Classified as a NoSQL database program, it uses JSON-like documents with optional schemas. The MongoDB API allows you to create additional database clusters or modify existing ones. Both tools, the Data Center Designer (DCD) and the API use the same concepts consistently and are well suited for smooth and intuitive use.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IonoscloudDbaasMongo
17
+ # List of snapshots.
18
+ class SnapshotList
19
+
20
+ attr_accessor :type
21
+
22
+
23
+ # The unique ID of the resource.
24
+ attr_accessor :id
25
+
26
+
27
+ attr_accessor :items
28
+
29
+
30
+ # The offset specified in the request (if none was specified, the default offset is 0) (not implemented yet).
31
+ attr_accessor :offset
32
+
33
+
34
+ # The limit specified in the request (if none was specified, use the endpoint's default pagination limit) (not implemented yet, always return number of items).
35
+ attr_accessor :limit
36
+
37
+
38
+ attr_accessor :_links
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+
44
+ :'type' => :'type',
45
+
46
+ :'id' => :'id',
47
+
48
+ :'items' => :'items',
49
+
50
+ :'offset' => :'offset',
51
+
52
+ :'limit' => :'limit',
53
+
54
+ :'_links' => :'_links'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+
67
+ :'type' => :'ResourceType',
68
+
69
+ :'id' => :'String',
70
+
71
+ :'items' => :'Array<SnapshotResponse>',
72
+
73
+ :'offset' => :'Integer',
74
+
75
+ :'limit' => :'Integer',
76
+
77
+ :'_links' => :'PaginationLinks'
78
+ }
79
+ end
80
+
81
+ # List of attributes with nullable: true
82
+ def self.openapi_nullable
83
+ Set.new([
84
+
85
+
86
+
87
+
88
+
89
+
90
+ ])
91
+ end
92
+
93
+ # List of class defined in allOf (OpenAPI v3)
94
+ def self.openapi_all_of
95
+ [
96
+ :'Pagination',
97
+ :'SnapshotListAllOf'
98
+ ]
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudDbaasMongo::SnapshotList` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ 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 `IonoscloudDbaasMongo::SnapshotList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+
117
+ if attributes.key?(:'type')
118
+ self.type = attributes[:'type']
119
+ end
120
+
121
+
122
+ if attributes.key?(:'id')
123
+ self.id = attributes[:'id']
124
+ end
125
+
126
+
127
+ if attributes.key?(:'items') && (value = attributes[:'items']).is_a?(Array)
128
+ self.items = value
129
+ end
130
+
131
+
132
+ if attributes.key?(:'offset')
133
+ self.offset = attributes[:'offset']
134
+ end
135
+
136
+
137
+ if attributes.key?(:'limit')
138
+ self.limit = attributes[:'limit']
139
+ end
140
+
141
+
142
+ if attributes.key?(:'_links')
143
+ self._links = attributes[:'_links']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+
152
+
153
+
154
+
155
+ if !@offset.nil? && @offset < 0
156
+ invalid_properties.push('invalid value for "offset", must be greater than or equal to 0.')
157
+ end
158
+
159
+
160
+ if !@limit.nil? && @limit < 0
161
+ invalid_properties.push('invalid value for "limit", must be greater than or equal to 0.')
162
+ end
163
+
164
+
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+
172
+
173
+
174
+
175
+ return false if !@offset.nil? && @offset < 0
176
+
177
+ return false if !@limit.nil? && @limit < 0
178
+
179
+ true
180
+ end
181
+
182
+
183
+
184
+
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] offset Value to be assigned
188
+ def offset=(offset)
189
+ if !offset.nil? && offset < 0
190
+ fail ArgumentError, 'invalid value for "offset", must be greater than or equal to 0.'
191
+ end
192
+
193
+ @offset = offset
194
+ end
195
+
196
+
197
+ # Custom attribute writer method with validation
198
+ # @param [Object] limit Value to be assigned
199
+ def limit=(limit)
200
+ if !limit.nil? && limit < 0
201
+ fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 0.'
202
+ end
203
+
204
+ @limit = limit
205
+ end
206
+
207
+
208
+ # Checks equality by comparing each attribute.
209
+ # @param [Object] Object to be compared
210
+ def ==(o)
211
+ return true if self.equal?(o)
212
+ self.class == o.class &&
213
+ type == o.type &&
214
+ id == o.id &&
215
+ items == o.items &&
216
+ offset == o.offset &&
217
+ limit == o.limit &&
218
+ _links == o._links
219
+ end
220
+
221
+ # @see the `==` method
222
+ # @param [Object] Object to be compared
223
+ def eql?(o)
224
+ self == o
225
+ end
226
+
227
+ # Calculates hash code according to all attributes.
228
+ # @return [Integer] Hash code
229
+ def hash
230
+ [type, id, items, offset, limit, _links].hash
231
+ end
232
+
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def self.build_from_hash(attributes)
237
+ new.build_from_hash(attributes)
238
+ end
239
+
240
+ # Builds the object from hash
241
+ # @param [Hash] attributes Model attributes in the form of hash
242
+ # @return [Object] Returns the model itself
243
+ def build_from_hash(attributes)
244
+ return nil unless attributes.is_a?(Hash)
245
+ self.class.openapi_types.each_pair do |key, type|
246
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
247
+ self.send("#{key}=", nil)
248
+ elsif type =~ /\AArray<(.*)>/i
249
+ # check to ensure the input is an array given that the attribute
250
+ # is documented as an array but the input is not
251
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
252
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
253
+ end
254
+ elsif !attributes[self.class.attribute_map[key]].nil?
255
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
256
+ end
257
+ end
258
+
259
+ self
260
+ end
261
+
262
+ # Deserializes the data based on type
263
+ # @param string type Data type
264
+ # @param string value Value to be deserialized
265
+ # @return [Object] Deserialized data
266
+ def _deserialize(type, value)
267
+ case type.to_sym
268
+ when :Time
269
+ Time.parse(value)
270
+ when :Date
271
+ Date.parse(value)
272
+ when :String
273
+ value.to_s
274
+ when :Integer
275
+ value.to_i
276
+ when :Float
277
+ value.to_f
278
+ when :Boolean
279
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
280
+ true
281
+ else
282
+ false
283
+ end
284
+ when :Object
285
+ # generic object (usually a Hash), return directly
286
+ value
287
+ when /\AArray<(?<inner_type>.+)>\z/
288
+ inner_type = Regexp.last_match[:inner_type]
289
+ value.map { |v| _deserialize(inner_type, v) }
290
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
291
+ k_type = Regexp.last_match[:k_type]
292
+ v_type = Regexp.last_match[:v_type]
293
+ {}.tap do |hash|
294
+ value.each do |k, v|
295
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
296
+ end
297
+ end
298
+ else # model
299
+ # models (e.g. Pet) or oneOf
300
+ klass = IonoscloudDbaasMongo.const_get(type)
301
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
302
+ end
303
+ end
304
+
305
+ # Returns the string representation of the object
306
+ # @return [String] String presentation of the object
307
+ def to_s
308
+ to_hash.to_s
309
+ end
310
+
311
+ # to_body is an alias to to_hash (backward compatibility)
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_body
314
+ to_hash
315
+ end
316
+
317
+ # Returns the object in the form of hash
318
+ # @return [Hash] Returns the object in the form of hash
319
+ def to_hash
320
+ hash = {}
321
+ self.class.attribute_map.each_pair do |attr, param|
322
+ value = self.send(attr)
323
+ if value.nil?
324
+ is_nullable = self.class.openapi_nullable.include?(attr)
325
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
326
+ end
327
+
328
+ hash[param] = _to_hash(value)
329
+ end
330
+ hash
331
+ end
332
+
333
+ # Outputs non-array value in the form of hash
334
+ # For object, use to_hash. Otherwise, just return the value
335
+ # @param [Object] value Any valid value
336
+ # @return [Hash] Returns the value in the form of hash
337
+ def _to_hash(value)
338
+ if value.is_a?(Array)
339
+ value.compact.map { |v| _to_hash(v) }
340
+ elsif value.is_a?(Hash)
341
+ {}.tap do |hash|
342
+ value.each { |k, v| hash[k] = _to_hash(v) }
343
+ end
344
+ elsif value.respond_to? :to_hash
345
+ value.to_hash
346
+ else
347
+ value
348
+ end
349
+ end
350
+
351
+ end
352
+
353
+ end
@@ -0,0 +1,261 @@
1
+ =begin
2
+ #IONOS DBaaS MongoDB REST API
3
+
4
+ #With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups and users via the API. MongoDB is an open source, cross-platform, document-oriented database program. Classified as a NoSQL database program, it uses JSON-like documents with optional schemas. The MongoDB API allows you to create additional database clusters or modify existing ones. Both tools, the Data Center Designer (DCD) and the API use the same concepts consistently and are well suited for smooth and intuitive use.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IonoscloudDbaasMongo
17
+ class SnapshotListAllOf
18
+
19
+ attr_accessor :type
20
+
21
+
22
+ # The unique ID of the resource.
23
+ attr_accessor :id
24
+
25
+
26
+ attr_accessor :items
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+
32
+ :'type' => :'type',
33
+
34
+ :'id' => :'id',
35
+
36
+ :'items' => :'items'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+
49
+ :'type' => :'ResourceType',
50
+
51
+ :'id' => :'String',
52
+
53
+ :'items' => :'Array<SnapshotResponse>'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+
61
+
62
+
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudDbaasMongo::SnapshotListAllOf` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudDbaasMongo::SnapshotListAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+
82
+ if attributes.key?(:'type')
83
+ self.type = attributes[:'type']
84
+ end
85
+
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+
92
+ if attributes.key?(:'items') && (value = attributes[:'items']).is_a?(Array)
93
+ self.items = value
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+
102
+
103
+
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+
111
+
112
+
113
+ true
114
+ end
115
+
116
+
117
+
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ type == o.type &&
125
+ id == o.id &&
126
+ items == o.items
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [type, id, items].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ new.build_from_hash(attributes)
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.openapi_types.each_pair do |key, type|
154
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
155
+ self.send("#{key}=", nil)
156
+ elsif type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ end
162
+ elsif !attributes[self.class.attribute_map[key]].nil?
163
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ end
165
+ end
166
+
167
+ self
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = IonoscloudDbaasMongo.const_get(type)
209
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end