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,282 @@
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
+ # A MongoDB template item.
18
+ class TemplateResponse
19
+
20
+ # The unique template ID.
21
+ attr_accessor :id
22
+
23
+
24
+ # The number of CPU cores.
25
+ attr_accessor :cores
26
+
27
+
28
+ # The amount of memory in GB.
29
+ attr_accessor :ram
30
+
31
+
32
+ # The amount of storage size in GB.
33
+ attr_accessor :storage_size
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+
39
+ :'id' => :'id',
40
+
41
+ :'cores' => :'cores',
42
+
43
+ :'ram' => :'ram',
44
+
45
+ :'storage_size' => :'storageSize'
46
+ }
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+
58
+ :'id' => :'String',
59
+
60
+ :'cores' => :'Integer',
61
+
62
+ :'ram' => :'Integer',
63
+
64
+ :'storage_size' => :'Integer'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+
72
+
73
+
74
+
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudDbaasMongo::TemplateResponse` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudDbaasMongo::TemplateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+
94
+ if attributes.key?(:'id')
95
+ self.id = attributes[:'id']
96
+ end
97
+
98
+
99
+ if attributes.key?(:'cores')
100
+ self.cores = attributes[:'cores']
101
+ end
102
+
103
+
104
+ if attributes.key?(:'ram')
105
+ self.ram = attributes[:'ram']
106
+ end
107
+
108
+
109
+ if attributes.key?(:'storage_size')
110
+ self.storage_size = attributes[:'storage_size']
111
+ end
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+
119
+
120
+
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+
129
+
130
+
131
+
132
+ true
133
+ end
134
+
135
+
136
+
137
+
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ id == o.id &&
145
+ cores == o.cores &&
146
+ ram == o.ram &&
147
+ storage_size == o.storage_size
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [id, cores, ram, storage_size].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ new.build_from_hash(attributes)
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
+ self.send("#{key}=", nil)
177
+ elsif type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = IonoscloudDbaasMongo.const_get(type)
230
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ 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
+ # MongoDB database user.
18
+ class User
19
+
20
+ attr_accessor :type
21
+
22
+
23
+ attr_accessor :metadata
24
+
25
+
26
+ attr_accessor :properties
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+
32
+ :'type' => :'type',
33
+
34
+ :'metadata' => :'metadata',
35
+
36
+ :'properties' => :'properties'
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
+ :'metadata' => :'UserMetadata',
52
+
53
+ :'properties' => :'UserProperties'
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::User` 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::User`. 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?(:'metadata')
88
+ self.metadata = attributes[:'metadata']
89
+ end
90
+
91
+
92
+ if attributes.key?(:'properties')
93
+ self.properties = attributes[:'properties']
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
+ metadata == o.metadata &&
126
+ properties == o.properties
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, metadata, properties].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