ultracart_api 4.0.67.rc → 4.0.69.rc

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.
@@ -0,0 +1,327 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class FileManagerDirectory
18
+ attr_accessor :active_theme_directory
19
+
20
+ attr_accessor :favorite
21
+
22
+ attr_accessor :hostname
23
+
24
+ attr_accessor :icon
25
+
26
+ attr_accessor :last_modified
27
+
28
+ attr_accessor :name
29
+
30
+ attr_accessor :parent_storefront_fs_directory_oid
31
+
32
+ attr_accessor :part_of_active_theme
33
+
34
+ attr_accessor :selected
35
+
36
+ attr_accessor :storefront_fs_directory_oid
37
+
38
+ attr_accessor :storefront_fs_file_oid
39
+
40
+ attr_accessor :storefront_oid
41
+
42
+ attr_accessor :type
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'active_theme_directory' => :'active_theme_directory',
48
+ :'favorite' => :'favorite',
49
+ :'hostname' => :'hostname',
50
+ :'icon' => :'icon',
51
+ :'last_modified' => :'last_modified',
52
+ :'name' => :'name',
53
+ :'parent_storefront_fs_directory_oid' => :'parent_storefront_fs_directory_oid',
54
+ :'part_of_active_theme' => :'part_of_active_theme',
55
+ :'selected' => :'selected',
56
+ :'storefront_fs_directory_oid' => :'storefront_fs_directory_oid',
57
+ :'storefront_fs_file_oid' => :'storefront_fs_file_oid',
58
+ :'storefront_oid' => :'storefront_oid',
59
+ :'type' => :'type'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'active_theme_directory' => :'Boolean',
72
+ :'favorite' => :'Boolean',
73
+ :'hostname' => :'String',
74
+ :'icon' => :'String',
75
+ :'last_modified' => :'String',
76
+ :'name' => :'String',
77
+ :'parent_storefront_fs_directory_oid' => :'Integer',
78
+ :'part_of_active_theme' => :'Boolean',
79
+ :'selected' => :'Boolean',
80
+ :'storefront_fs_directory_oid' => :'Integer',
81
+ :'storefront_fs_file_oid' => :'Integer',
82
+ :'storefront_oid' => :'Integer',
83
+ :'type' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::FileManagerDirectory` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::FileManagerDirectory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'active_theme_directory')
109
+ self.active_theme_directory = attributes[:'active_theme_directory']
110
+ end
111
+
112
+ if attributes.key?(:'favorite')
113
+ self.favorite = attributes[:'favorite']
114
+ end
115
+
116
+ if attributes.key?(:'hostname')
117
+ self.hostname = attributes[:'hostname']
118
+ end
119
+
120
+ if attributes.key?(:'icon')
121
+ self.icon = attributes[:'icon']
122
+ end
123
+
124
+ if attributes.key?(:'last_modified')
125
+ self.last_modified = attributes[:'last_modified']
126
+ end
127
+
128
+ if attributes.key?(:'name')
129
+ self.name = attributes[:'name']
130
+ end
131
+
132
+ if attributes.key?(:'parent_storefront_fs_directory_oid')
133
+ self.parent_storefront_fs_directory_oid = attributes[:'parent_storefront_fs_directory_oid']
134
+ end
135
+
136
+ if attributes.key?(:'part_of_active_theme')
137
+ self.part_of_active_theme = attributes[:'part_of_active_theme']
138
+ end
139
+
140
+ if attributes.key?(:'selected')
141
+ self.selected = attributes[:'selected']
142
+ end
143
+
144
+ if attributes.key?(:'storefront_fs_directory_oid')
145
+ self.storefront_fs_directory_oid = attributes[:'storefront_fs_directory_oid']
146
+ end
147
+
148
+ if attributes.key?(:'storefront_fs_file_oid')
149
+ self.storefront_fs_file_oid = attributes[:'storefront_fs_file_oid']
150
+ end
151
+
152
+ if attributes.key?(:'storefront_oid')
153
+ self.storefront_oid = attributes[:'storefront_oid']
154
+ end
155
+
156
+ if attributes.key?(:'type')
157
+ self.type = attributes[:'type']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
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
+ true
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ active_theme_directory == o.active_theme_directory &&
180
+ favorite == o.favorite &&
181
+ hostname == o.hostname &&
182
+ icon == o.icon &&
183
+ last_modified == o.last_modified &&
184
+ name == o.name &&
185
+ parent_storefront_fs_directory_oid == o.parent_storefront_fs_directory_oid &&
186
+ part_of_active_theme == o.part_of_active_theme &&
187
+ selected == o.selected &&
188
+ storefront_fs_directory_oid == o.storefront_fs_directory_oid &&
189
+ storefront_fs_file_oid == o.storefront_fs_file_oid &&
190
+ storefront_oid == o.storefront_oid &&
191
+ type == o.type
192
+ end
193
+
194
+ # @see the `==` method
195
+ # @param [Object] Object to be compared
196
+ def eql?(o)
197
+ self == o
198
+ end
199
+
200
+ # Calculates hash code according to all attributes.
201
+ # @return [Integer] Hash code
202
+ def hash
203
+ [active_theme_directory, favorite, hostname, icon, last_modified, name, parent_storefront_fs_directory_oid, part_of_active_theme, selected, storefront_fs_directory_oid, storefront_fs_file_oid, storefront_oid, type].hash
204
+ end
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def self.build_from_hash(attributes)
210
+ new.build_from_hash(attributes)
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def build_from_hash(attributes)
217
+ return nil unless attributes.is_a?(Hash)
218
+ attributes = attributes.transform_keys(&:to_sym)
219
+ self.class.openapi_types.each_pair do |key, type|
220
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
221
+ self.send("#{key}=", nil)
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :Time
243
+ Time.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ # models (e.g. Pet) or oneOf
274
+ klass = UltracartClient.const_get(type)
275
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
+ end
277
+ end
278
+
279
+ # Returns the string representation of the object
280
+ # @return [String] String presentation of the object
281
+ def to_s
282
+ to_hash.to_s
283
+ end
284
+
285
+ # to_body is an alias to to_hash (backward compatibility)
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_body
288
+ to_hash
289
+ end
290
+
291
+ # Returns the object in the form of hash
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_hash
294
+ hash = {}
295
+ self.class.attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ if value.nil?
298
+ is_nullable = self.class.openapi_nullable.include?(attr)
299
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
+ end
301
+
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map { |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end
@@ -0,0 +1,381 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class FileManagerFile
18
+ attr_accessor :favorite
19
+
20
+ attr_accessor :hostname
21
+
22
+ attr_accessor :i18n_violation
23
+
24
+ attr_accessor :icon
25
+
26
+ attr_accessor :internal_version
27
+
28
+ attr_accessor :last_modified
29
+
30
+ attr_accessor :merge_conflict
31
+
32
+ attr_accessor :name
33
+
34
+ attr_accessor :parent_storefront_fs_directory_oid
35
+
36
+ attr_accessor :part_of_active_theme
37
+
38
+ attr_accessor :path
39
+
40
+ attr_accessor :raw_size
41
+
42
+ attr_accessor :selected
43
+
44
+ attr_accessor :size
45
+
46
+ attr_accessor :storefront_fs_directory_oid
47
+
48
+ attr_accessor :storefront_fs_file_oid
49
+
50
+ attr_accessor :storefront_oid
51
+
52
+ attr_accessor :type
53
+
54
+ attr_accessor :valid_velocity
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'favorite' => :'favorite',
60
+ :'hostname' => :'hostname',
61
+ :'i18n_violation' => :'i18n_violation',
62
+ :'icon' => :'icon',
63
+ :'internal_version' => :'internal_version',
64
+ :'last_modified' => :'last_modified',
65
+ :'merge_conflict' => :'merge_conflict',
66
+ :'name' => :'name',
67
+ :'parent_storefront_fs_directory_oid' => :'parent_storefront_fs_directory_oid',
68
+ :'part_of_active_theme' => :'part_of_active_theme',
69
+ :'path' => :'path',
70
+ :'raw_size' => :'raw_size',
71
+ :'selected' => :'selected',
72
+ :'size' => :'size',
73
+ :'storefront_fs_directory_oid' => :'storefront_fs_directory_oid',
74
+ :'storefront_fs_file_oid' => :'storefront_fs_file_oid',
75
+ :'storefront_oid' => :'storefront_oid',
76
+ :'type' => :'type',
77
+ :'valid_velocity' => :'valid_velocity'
78
+ }
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'favorite' => :'Boolean',
90
+ :'hostname' => :'String',
91
+ :'i18n_violation' => :'Boolean',
92
+ :'icon' => :'String',
93
+ :'internal_version' => :'Integer',
94
+ :'last_modified' => :'String',
95
+ :'merge_conflict' => :'Boolean',
96
+ :'name' => :'String',
97
+ :'parent_storefront_fs_directory_oid' => :'Integer',
98
+ :'part_of_active_theme' => :'Boolean',
99
+ :'path' => :'String',
100
+ :'raw_size' => :'Integer',
101
+ :'selected' => :'Boolean',
102
+ :'size' => :'String',
103
+ :'storefront_fs_directory_oid' => :'Integer',
104
+ :'storefront_fs_file_oid' => :'Integer',
105
+ :'storefront_oid' => :'Integer',
106
+ :'type' => :'String',
107
+ :'valid_velocity' => :'String'
108
+ }
109
+ end
110
+
111
+ # List of attributes with nullable: true
112
+ def self.openapi_nullable
113
+ Set.new([
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::FileManagerFile` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!self.class.attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::FileManagerFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'favorite')
133
+ self.favorite = attributes[:'favorite']
134
+ end
135
+
136
+ if attributes.key?(:'hostname')
137
+ self.hostname = attributes[:'hostname']
138
+ end
139
+
140
+ if attributes.key?(:'i18n_violation')
141
+ self.i18n_violation = attributes[:'i18n_violation']
142
+ end
143
+
144
+ if attributes.key?(:'icon')
145
+ self.icon = attributes[:'icon']
146
+ end
147
+
148
+ if attributes.key?(:'internal_version')
149
+ self.internal_version = attributes[:'internal_version']
150
+ end
151
+
152
+ if attributes.key?(:'last_modified')
153
+ self.last_modified = attributes[:'last_modified']
154
+ end
155
+
156
+ if attributes.key?(:'merge_conflict')
157
+ self.merge_conflict = attributes[:'merge_conflict']
158
+ end
159
+
160
+ if attributes.key?(:'name')
161
+ self.name = attributes[:'name']
162
+ end
163
+
164
+ if attributes.key?(:'parent_storefront_fs_directory_oid')
165
+ self.parent_storefront_fs_directory_oid = attributes[:'parent_storefront_fs_directory_oid']
166
+ end
167
+
168
+ if attributes.key?(:'part_of_active_theme')
169
+ self.part_of_active_theme = attributes[:'part_of_active_theme']
170
+ end
171
+
172
+ if attributes.key?(:'path')
173
+ self.path = attributes[:'path']
174
+ end
175
+
176
+ if attributes.key?(:'raw_size')
177
+ self.raw_size = attributes[:'raw_size']
178
+ end
179
+
180
+ if attributes.key?(:'selected')
181
+ self.selected = attributes[:'selected']
182
+ end
183
+
184
+ if attributes.key?(:'size')
185
+ self.size = attributes[:'size']
186
+ end
187
+
188
+ if attributes.key?(:'storefront_fs_directory_oid')
189
+ self.storefront_fs_directory_oid = attributes[:'storefront_fs_directory_oid']
190
+ end
191
+
192
+ if attributes.key?(:'storefront_fs_file_oid')
193
+ self.storefront_fs_file_oid = attributes[:'storefront_fs_file_oid']
194
+ end
195
+
196
+ if attributes.key?(:'storefront_oid')
197
+ self.storefront_oid = attributes[:'storefront_oid']
198
+ end
199
+
200
+ if attributes.key?(:'type')
201
+ self.type = attributes[:'type']
202
+ end
203
+
204
+ if attributes.key?(:'valid_velocity')
205
+ self.valid_velocity = attributes[:'valid_velocity']
206
+ end
207
+ end
208
+
209
+ # Show invalid properties with the reasons. Usually used together with valid?
210
+ # @return Array for valid properties with the reasons
211
+ def list_invalid_properties
212
+ invalid_properties = Array.new
213
+ invalid_properties
214
+ end
215
+
216
+ # Check to see if the all the properties in the model are valid
217
+ # @return true if the model is valid
218
+ def valid?
219
+ true
220
+ end
221
+
222
+ # Checks equality by comparing each attribute.
223
+ # @param [Object] Object to be compared
224
+ def ==(o)
225
+ return true if self.equal?(o)
226
+ self.class == o.class &&
227
+ favorite == o.favorite &&
228
+ hostname == o.hostname &&
229
+ i18n_violation == o.i18n_violation &&
230
+ icon == o.icon &&
231
+ internal_version == o.internal_version &&
232
+ last_modified == o.last_modified &&
233
+ merge_conflict == o.merge_conflict &&
234
+ name == o.name &&
235
+ parent_storefront_fs_directory_oid == o.parent_storefront_fs_directory_oid &&
236
+ part_of_active_theme == o.part_of_active_theme &&
237
+ path == o.path &&
238
+ raw_size == o.raw_size &&
239
+ selected == o.selected &&
240
+ size == o.size &&
241
+ storefront_fs_directory_oid == o.storefront_fs_directory_oid &&
242
+ storefront_fs_file_oid == o.storefront_fs_file_oid &&
243
+ storefront_oid == o.storefront_oid &&
244
+ type == o.type &&
245
+ valid_velocity == o.valid_velocity
246
+ end
247
+
248
+ # @see the `==` method
249
+ # @param [Object] Object to be compared
250
+ def eql?(o)
251
+ self == o
252
+ end
253
+
254
+ # Calculates hash code according to all attributes.
255
+ # @return [Integer] Hash code
256
+ def hash
257
+ [favorite, hostname, i18n_violation, icon, internal_version, last_modified, merge_conflict, name, parent_storefront_fs_directory_oid, part_of_active_theme, path, raw_size, selected, size, storefront_fs_directory_oid, storefront_fs_file_oid, storefront_oid, type, valid_velocity].hash
258
+ end
259
+
260
+ # Builds the object from hash
261
+ # @param [Hash] attributes Model attributes in the form of hash
262
+ # @return [Object] Returns the model itself
263
+ def self.build_from_hash(attributes)
264
+ new.build_from_hash(attributes)
265
+ end
266
+
267
+ # Builds the object from hash
268
+ # @param [Hash] attributes Model attributes in the form of hash
269
+ # @return [Object] Returns the model itself
270
+ def build_from_hash(attributes)
271
+ return nil unless attributes.is_a?(Hash)
272
+ attributes = attributes.transform_keys(&:to_sym)
273
+ self.class.openapi_types.each_pair do |key, type|
274
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
275
+ self.send("#{key}=", nil)
276
+ elsif type =~ /\AArray<(.*)>/i
277
+ # check to ensure the input is an array given that the attribute
278
+ # is documented as an array but the input is not
279
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
280
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
281
+ end
282
+ elsif !attributes[self.class.attribute_map[key]].nil?
283
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
284
+ end
285
+ end
286
+
287
+ self
288
+ end
289
+
290
+ # Deserializes the data based on type
291
+ # @param string type Data type
292
+ # @param string value Value to be deserialized
293
+ # @return [Object] Deserialized data
294
+ def _deserialize(type, value)
295
+ case type.to_sym
296
+ when :Time
297
+ Time.parse(value)
298
+ when :Date
299
+ Date.parse(value)
300
+ when :String
301
+ value.to_s
302
+ when :Integer
303
+ value.to_i
304
+ when :Float
305
+ value.to_f
306
+ when :Boolean
307
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
308
+ true
309
+ else
310
+ false
311
+ end
312
+ when :Object
313
+ # generic object (usually a Hash), return directly
314
+ value
315
+ when /\AArray<(?<inner_type>.+)>\z/
316
+ inner_type = Regexp.last_match[:inner_type]
317
+ value.map { |v| _deserialize(inner_type, v) }
318
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
319
+ k_type = Regexp.last_match[:k_type]
320
+ v_type = Regexp.last_match[:v_type]
321
+ {}.tap do |hash|
322
+ value.each do |k, v|
323
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
324
+ end
325
+ end
326
+ else # model
327
+ # models (e.g. Pet) or oneOf
328
+ klass = UltracartClient.const_get(type)
329
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
330
+ end
331
+ end
332
+
333
+ # Returns the string representation of the object
334
+ # @return [String] String presentation of the object
335
+ def to_s
336
+ to_hash.to_s
337
+ end
338
+
339
+ # to_body is an alias to to_hash (backward compatibility)
340
+ # @return [Hash] Returns the object in the form of hash
341
+ def to_body
342
+ to_hash
343
+ end
344
+
345
+ # Returns the object in the form of hash
346
+ # @return [Hash] Returns the object in the form of hash
347
+ def to_hash
348
+ hash = {}
349
+ self.class.attribute_map.each_pair do |attr, param|
350
+ value = self.send(attr)
351
+ if value.nil?
352
+ is_nullable = self.class.openapi_nullable.include?(attr)
353
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
354
+ end
355
+
356
+ hash[param] = _to_hash(value)
357
+ end
358
+ hash
359
+ end
360
+
361
+ # Outputs non-array value in the form of hash
362
+ # For object, use to_hash. Otherwise, just return the value
363
+ # @param [Object] value Any valid value
364
+ # @return [Hash] Returns the value in the form of hash
365
+ def _to_hash(value)
366
+ if value.is_a?(Array)
367
+ value.compact.map { |v| _to_hash(v) }
368
+ elsif value.is_a?(Hash)
369
+ {}.tap do |hash|
370
+ value.each { |k, v| hash[k] = _to_hash(v) }
371
+ end
372
+ elsif value.respond_to? :to_hash
373
+ value.to_hash
374
+ else
375
+ value
376
+ end
377
+ end
378
+
379
+ end
380
+
381
+ end