mailslurp_client 15.5.6 → 15.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/api_internal_controller_api.rb +89 -0
  3. data/lib/mailslurp_client/api/bounce_controller_api.rb +64 -0
  4. data/lib/mailslurp_client/api/email_verification_controller_api.rb +179 -0
  5. data/lib/mailslurp_client/api/mail_server_controller_api.rb +2 -2
  6. data/lib/mailslurp_client/models/alias_projection.rb +13 -13
  7. data/lib/mailslurp_client/models/bounce_recipient.rb +0 -5
  8. data/lib/mailslurp_client/models/bounced_recipient_dto.rb +0 -5
  9. data/lib/mailslurp_client/models/email_projection.rb +12 -12
  10. data/lib/mailslurp_client/models/email_validation_request.rb +276 -0
  11. data/lib/mailslurp_client/models/filter_bounced_recipients_options.rb +213 -0
  12. data/lib/mailslurp_client/models/filter_bounced_recipients_result.rb +213 -0
  13. data/lib/mailslurp_client/models/get_or_create_saml_user_options.rb +234 -0
  14. data/lib/mailslurp_client/models/page_email_validation_request.rb +308 -0
  15. data/lib/mailslurp_client/models/send_email_options.rb +36 -4
  16. data/lib/mailslurp_client/models/sent_email_dto.rb +13 -4
  17. data/lib/mailslurp_client/models/sent_email_projection.rb +17 -17
  18. data/lib/mailslurp_client/models/template_projection.rb +18 -18
  19. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  20. data/lib/mailslurp_client/models/user_dto.rb +438 -0
  21. data/lib/mailslurp_client/models/validate_email_address_list_options.rb +213 -0
  22. data/lib/mailslurp_client/models/validate_email_address_list_result.rb +245 -0
  23. data/lib/mailslurp_client/version.rb +1 -1
  24. data/lib/mailslurp_client.rb +10 -0
  25. metadata +12 -2
@@ -0,0 +1,438 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ # Representation a user's account
17
+ class UserDto
18
+ attr_accessor :id
19
+
20
+ attr_accessor :api_key
21
+
22
+ attr_accessor :email_address
23
+
24
+ attr_accessor :email_address_md5
25
+
26
+ attr_accessor :created
27
+
28
+ attr_accessor :user_type
29
+
30
+ # Does user belong to an organization
31
+ attr_accessor :organization
32
+
33
+ # Has user accepted an organization invite
34
+ attr_accessor :verified
35
+
36
+ attr_accessor :has_password
37
+
38
+ attr_accessor :is_frozen
39
+
40
+ attr_accessor :add_new_contacts
41
+
42
+ attr_accessor :sso_provider
43
+
44
+ attr_accessor :customer_id
45
+
46
+ attr_accessor :has_onboarded
47
+
48
+ attr_accessor :imap_username
49
+
50
+ attr_accessor :imap_password
51
+
52
+ attr_accessor :smtp_username
53
+
54
+ attr_accessor :smtp_password
55
+
56
+ class EnumAttributeValidator
57
+ attr_reader :datatype
58
+ attr_reader :allowable_values
59
+
60
+ def initialize(datatype, allowable_values)
61
+ @allowable_values = allowable_values.map do |value|
62
+ case datatype.to_s
63
+ when /Integer/i
64
+ value.to_i
65
+ when /Float/i
66
+ value.to_f
67
+ else
68
+ value
69
+ end
70
+ end
71
+ end
72
+
73
+ def valid?(value)
74
+ !value || allowable_values.include?(value)
75
+ end
76
+ end
77
+
78
+ # Attribute mapping from ruby-style variable name to JSON key.
79
+ def self.attribute_map
80
+ {
81
+ :'id' => :'id',
82
+ :'api_key' => :'apiKey',
83
+ :'email_address' => :'emailAddress',
84
+ :'email_address_md5' => :'emailAddressMd5',
85
+ :'created' => :'created',
86
+ :'user_type' => :'userType',
87
+ :'organization' => :'organization',
88
+ :'verified' => :'verified',
89
+ :'has_password' => :'hasPassword',
90
+ :'is_frozen' => :'isFrozen',
91
+ :'add_new_contacts' => :'addNewContacts',
92
+ :'sso_provider' => :'ssoProvider',
93
+ :'customer_id' => :'customerId',
94
+ :'has_onboarded' => :'hasOnboarded',
95
+ :'imap_username' => :'imapUsername',
96
+ :'imap_password' => :'imapPassword',
97
+ :'smtp_username' => :'smtpUsername',
98
+ :'smtp_password' => :'smtpPassword'
99
+ }
100
+ end
101
+
102
+ # Attribute type mapping.
103
+ def self.openapi_types
104
+ {
105
+ :'id' => :'String',
106
+ :'api_key' => :'String',
107
+ :'email_address' => :'String',
108
+ :'email_address_md5' => :'String',
109
+ :'created' => :'DateTime',
110
+ :'user_type' => :'String',
111
+ :'organization' => :'String',
112
+ :'verified' => :'String',
113
+ :'has_password' => :'Boolean',
114
+ :'is_frozen' => :'Boolean',
115
+ :'add_new_contacts' => :'Boolean',
116
+ :'sso_provider' => :'String',
117
+ :'customer_id' => :'String',
118
+ :'has_onboarded' => :'Boolean',
119
+ :'imap_username' => :'String',
120
+ :'imap_password' => :'String',
121
+ :'smtp_username' => :'String',
122
+ :'smtp_password' => :'String'
123
+ }
124
+ end
125
+
126
+ # List of attributes with nullable: true
127
+ def self.openapi_nullable
128
+ Set.new([
129
+ ])
130
+ end
131
+
132
+ # Initializes the object
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ def initialize(attributes = {})
135
+ if (!attributes.is_a?(Hash))
136
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::UserDto` initialize method"
137
+ end
138
+
139
+ # check to see if the attribute exists and convert string to symbol for hash key
140
+ attributes = attributes.each_with_object({}) { |(k, v), h|
141
+ if (!self.class.attribute_map.key?(k.to_sym))
142
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::UserDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
143
+ end
144
+ h[k.to_sym] = v
145
+ }
146
+
147
+ if attributes.key?(:'id')
148
+ self.id = attributes[:'id']
149
+ end
150
+
151
+ if attributes.key?(:'api_key')
152
+ self.api_key = attributes[:'api_key']
153
+ end
154
+
155
+ if attributes.key?(:'email_address')
156
+ self.email_address = attributes[:'email_address']
157
+ end
158
+
159
+ if attributes.key?(:'email_address_md5')
160
+ self.email_address_md5 = attributes[:'email_address_md5']
161
+ end
162
+
163
+ if attributes.key?(:'created')
164
+ self.created = attributes[:'created']
165
+ end
166
+
167
+ if attributes.key?(:'user_type')
168
+ self.user_type = attributes[:'user_type']
169
+ end
170
+
171
+ if attributes.key?(:'organization')
172
+ self.organization = attributes[:'organization']
173
+ end
174
+
175
+ if attributes.key?(:'verified')
176
+ self.verified = attributes[:'verified']
177
+ end
178
+
179
+ if attributes.key?(:'has_password')
180
+ self.has_password = attributes[:'has_password']
181
+ end
182
+
183
+ if attributes.key?(:'is_frozen')
184
+ self.is_frozen = attributes[:'is_frozen']
185
+ end
186
+
187
+ if attributes.key?(:'add_new_contacts')
188
+ self.add_new_contacts = attributes[:'add_new_contacts']
189
+ end
190
+
191
+ if attributes.key?(:'sso_provider')
192
+ self.sso_provider = attributes[:'sso_provider']
193
+ end
194
+
195
+ if attributes.key?(:'customer_id')
196
+ self.customer_id = attributes[:'customer_id']
197
+ end
198
+
199
+ if attributes.key?(:'has_onboarded')
200
+ self.has_onboarded = attributes[:'has_onboarded']
201
+ end
202
+
203
+ if attributes.key?(:'imap_username')
204
+ self.imap_username = attributes[:'imap_username']
205
+ end
206
+
207
+ if attributes.key?(:'imap_password')
208
+ self.imap_password = attributes[:'imap_password']
209
+ end
210
+
211
+ if attributes.key?(:'smtp_username')
212
+ self.smtp_username = attributes[:'smtp_username']
213
+ end
214
+
215
+ if attributes.key?(:'smtp_password')
216
+ self.smtp_password = attributes[:'smtp_password']
217
+ end
218
+ end
219
+
220
+ # Show invalid properties with the reasons. Usually used together with valid?
221
+ # @return Array for valid properties with the reasons
222
+ def list_invalid_properties
223
+ invalid_properties = Array.new
224
+ if @id.nil?
225
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
226
+ end
227
+
228
+ if @api_key.nil?
229
+ invalid_properties.push('invalid value for "api_key", api_key cannot be nil.')
230
+ end
231
+
232
+ if @email_address.nil?
233
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
234
+ end
235
+
236
+ if @email_address_md5.nil?
237
+ invalid_properties.push('invalid value for "email_address_md5", email_address_md5 cannot be nil.')
238
+ end
239
+
240
+ if @has_password.nil?
241
+ invalid_properties.push('invalid value for "has_password", has_password cannot be nil.')
242
+ end
243
+
244
+ if @is_frozen.nil?
245
+ invalid_properties.push('invalid value for "is_frozen", is_frozen cannot be nil.')
246
+ end
247
+
248
+ invalid_properties
249
+ end
250
+
251
+ # Check to see if the all the properties in the model are valid
252
+ # @return true if the model is valid
253
+ def valid?
254
+ return false if @id.nil?
255
+ return false if @api_key.nil?
256
+ return false if @email_address.nil?
257
+ return false if @email_address_md5.nil?
258
+ user_type_validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM"])
259
+ return false unless user_type_validator.valid?(@user_type)
260
+ verified_validator = EnumAttributeValidator.new('String', ["VERIFIED", "PENDING"])
261
+ return false unless verified_validator.valid?(@verified)
262
+ return false if @has_password.nil?
263
+ return false if @is_frozen.nil?
264
+ true
265
+ end
266
+
267
+ # Custom attribute writer method checking allowed values (enum).
268
+ # @param [Object] user_type Object to be assigned
269
+ def user_type=(user_type)
270
+ validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM"])
271
+ unless validator.valid?(user_type)
272
+ fail ArgumentError, "invalid value for \"user_type\", must be one of #{validator.allowable_values}."
273
+ end
274
+ @user_type = user_type
275
+ end
276
+
277
+ # Custom attribute writer method checking allowed values (enum).
278
+ # @param [Object] verified Object to be assigned
279
+ def verified=(verified)
280
+ validator = EnumAttributeValidator.new('String', ["VERIFIED", "PENDING"])
281
+ unless validator.valid?(verified)
282
+ fail ArgumentError, "invalid value for \"verified\", must be one of #{validator.allowable_values}."
283
+ end
284
+ @verified = verified
285
+ end
286
+
287
+ # Checks equality by comparing each attribute.
288
+ # @param [Object] Object to be compared
289
+ def ==(o)
290
+ return true if self.equal?(o)
291
+ self.class == o.class &&
292
+ id == o.id &&
293
+ api_key == o.api_key &&
294
+ email_address == o.email_address &&
295
+ email_address_md5 == o.email_address_md5 &&
296
+ created == o.created &&
297
+ user_type == o.user_type &&
298
+ organization == o.organization &&
299
+ verified == o.verified &&
300
+ has_password == o.has_password &&
301
+ is_frozen == o.is_frozen &&
302
+ add_new_contacts == o.add_new_contacts &&
303
+ sso_provider == o.sso_provider &&
304
+ customer_id == o.customer_id &&
305
+ has_onboarded == o.has_onboarded &&
306
+ imap_username == o.imap_username &&
307
+ imap_password == o.imap_password &&
308
+ smtp_username == o.smtp_username &&
309
+ smtp_password == o.smtp_password
310
+ end
311
+
312
+ # @see the `==` method
313
+ # @param [Object] Object to be compared
314
+ def eql?(o)
315
+ self == o
316
+ end
317
+
318
+ # Calculates hash code according to all attributes.
319
+ # @return [Integer] Hash code
320
+ def hash
321
+ [id, api_key, email_address, email_address_md5, created, user_type, organization, verified, has_password, is_frozen, add_new_contacts, sso_provider, customer_id, has_onboarded, imap_username, imap_password, smtp_username, smtp_password].hash
322
+ end
323
+
324
+ # Builds the object from hash
325
+ # @param [Hash] attributes Model attributes in the form of hash
326
+ # @return [Object] Returns the model itself
327
+ def self.build_from_hash(attributes)
328
+ new.build_from_hash(attributes)
329
+ end
330
+
331
+ # Builds the object from hash
332
+ # @param [Hash] attributes Model attributes in the form of hash
333
+ # @return [Object] Returns the model itself
334
+ def build_from_hash(attributes)
335
+ return nil unless attributes.is_a?(Hash)
336
+ self.class.openapi_types.each_pair do |key, type|
337
+ if type =~ /\AArray<(.*)>/i
338
+ # check to ensure the input is an array given that the attribute
339
+ # is documented as an array but the input is not
340
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
341
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
342
+ end
343
+ elsif !attributes[self.class.attribute_map[key]].nil?
344
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
345
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
346
+ end
347
+
348
+ self
349
+ end
350
+
351
+ # Deserializes the data based on type
352
+ # @param string type Data type
353
+ # @param string value Value to be deserialized
354
+ # @return [Object] Deserialized data
355
+ def _deserialize(type, value)
356
+ case type.to_sym
357
+ when :DateTime
358
+ DateTime.parse(value)
359
+ when :Date
360
+ Date.parse(value)
361
+ when :String
362
+ value.to_s
363
+ when :Integer
364
+ value.to_i
365
+ when :Float
366
+ value.to_f
367
+ when :Boolean
368
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
369
+ true
370
+ else
371
+ false
372
+ end
373
+ when :Object
374
+ # generic object (usually a Hash), return directly
375
+ value
376
+ when /\AArray<(?<inner_type>.+)>\z/
377
+ inner_type = Regexp.last_match[:inner_type]
378
+ value.map { |v| _deserialize(inner_type, v) }
379
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
380
+ k_type = Regexp.last_match[:k_type]
381
+ v_type = Regexp.last_match[:v_type]
382
+ {}.tap do |hash|
383
+ value.each do |k, v|
384
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
385
+ end
386
+ end
387
+ else # model
388
+ MailSlurpClient.const_get(type).build_from_hash(value)
389
+ end
390
+ end
391
+
392
+ # Returns the string representation of the object
393
+ # @return [String] String presentation of the object
394
+ def to_s
395
+ to_hash.to_s
396
+ end
397
+
398
+ # to_body is an alias to to_hash (backward compatibility)
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_body
401
+ to_hash
402
+ end
403
+
404
+ # Returns the object in the form of hash
405
+ # @return [Hash] Returns the object in the form of hash
406
+ def to_hash
407
+ hash = {}
408
+ self.class.attribute_map.each_pair do |attr, param|
409
+ value = self.send(attr)
410
+ if value.nil?
411
+ is_nullable = self.class.openapi_nullable.include?(attr)
412
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
413
+ end
414
+
415
+ hash[param] = _to_hash(value)
416
+ end
417
+ hash
418
+ end
419
+
420
+ # Outputs non-array value in the form of hash
421
+ # For object, use to_hash. Otherwise, just return the value
422
+ # @param [Object] value Any valid value
423
+ # @return [Hash] Returns the value in the form of hash
424
+ def _to_hash(value)
425
+ if value.is_a?(Array)
426
+ value.compact.map { |v| _to_hash(v) }
427
+ elsif value.is_a?(Hash)
428
+ {}.tap do |hash|
429
+ value.each { |k, v| hash[k] = _to_hash(v) }
430
+ end
431
+ elsif value.respond_to? :to_hash
432
+ value.to_hash
433
+ else
434
+ value
435
+ end
436
+ end
437
+ end
438
+ end
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class ValidateEmailAddressListOptions
17
+ attr_accessor :email_address_list
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'email_address_list' => :'emailAddressList'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'email_address_list' => :'Array<String>'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ValidateEmailAddressListOptions` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ValidateEmailAddressListOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'email_address_list')
55
+ if (value = attributes[:'email_address_list']).is_a?(Array)
56
+ self.email_address_list = value
57
+ end
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ if @email_address_list.nil?
66
+ invalid_properties.push('invalid value for "email_address_list", email_address_list cannot be nil.')
67
+ end
68
+
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @email_address_list.nil?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ email_address_list == o.email_address_list
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [email_address_list].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ MailSlurpClient.const_get(type).build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end