mailslurp_client 15.2.8 → 15.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/inbox_controller_api.rb +176 -0
  3. data/lib/mailslurp_client/models/alias_projection.rb +15 -15
  4. data/lib/mailslurp_client/models/attachment_projection.rb +28 -28
  5. data/lib/mailslurp_client/models/contact_projection.rb +13 -13
  6. data/lib/mailslurp_client/models/email_projection.rb +10 -10
  7. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  8. data/lib/mailslurp_client/models/imap_smtp_access_details.rb +309 -0
  9. data/lib/mailslurp_client/models/inbox_by_email_address_result.rb +220 -0
  10. data/lib/mailslurp_client/models/inbox_id_item.rb +225 -0
  11. data/lib/mailslurp_client/models/inbox_ids_result.rb +213 -0
  12. data/lib/mailslurp_client/models/page_alias.rb +19 -19
  13. data/lib/mailslurp_client/models/page_attachment_entity.rb +19 -19
  14. data/lib/mailslurp_client/models/page_bounced_email.rb +19 -19
  15. data/lib/mailslurp_client/models/page_bounced_recipients.rb +19 -19
  16. data/lib/mailslurp_client/models/page_contact_projection.rb +19 -19
  17. data/lib/mailslurp_client/models/page_email_preview.rb +19 -19
  18. data/lib/mailslurp_client/models/page_email_projection.rb +19 -19
  19. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +19 -19
  20. data/lib/mailslurp_client/models/page_group_projection.rb +19 -19
  21. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +19 -19
  22. data/lib/mailslurp_client/models/page_inbox_projection.rb +19 -19
  23. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +19 -19
  24. data/lib/mailslurp_client/models/page_missed_email_projection.rb +19 -19
  25. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +19 -19
  26. data/lib/mailslurp_client/models/page_template_projection.rb +19 -19
  27. data/lib/mailslurp_client/models/page_thread_projection.rb +19 -19
  28. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +19 -19
  29. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +19 -19
  30. data/lib/mailslurp_client/models/page_webhook_projection.rb +19 -19
  31. data/lib/mailslurp_client/models/page_webhook_result.rb +19 -19
  32. data/lib/mailslurp_client/models/sent_email_projection.rb +15 -15
  33. data/lib/mailslurp_client/models/thread_projection.rb +24 -24
  34. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  35. data/lib/mailslurp_client/version.rb +1 -1
  36. data/lib/mailslurp_client.rb +4 -0
  37. metadata +6 -2
@@ -16,18 +16,18 @@ module MailSlurpClient
16
16
  class ExpiredInboxRecordProjection
17
17
  attr_accessor :id
18
18
 
19
- attr_accessor :email_address
20
-
21
19
  attr_accessor :user_id
22
20
 
21
+ attr_accessor :email_address
22
+
23
23
  attr_accessor :created_at
24
24
 
25
25
  # Attribute mapping from ruby-style variable name to JSON key.
26
26
  def self.attribute_map
27
27
  {
28
28
  :'id' => :'id',
29
- :'email_address' => :'emailAddress',
30
29
  :'user_id' => :'userId',
30
+ :'email_address' => :'emailAddress',
31
31
  :'created_at' => :'createdAt'
32
32
  }
33
33
  end
@@ -36,8 +36,8 @@ module MailSlurpClient
36
36
  def self.openapi_types
37
37
  {
38
38
  :'id' => :'String',
39
- :'email_address' => :'String',
40
39
  :'user_id' => :'String',
40
+ :'email_address' => :'String',
41
41
  :'created_at' => :'DateTime'
42
42
  }
43
43
  end
@@ -67,14 +67,14 @@ module MailSlurpClient
67
67
  self.id = attributes[:'id']
68
68
  end
69
69
 
70
- if attributes.key?(:'email_address')
71
- self.email_address = attributes[:'email_address']
72
- end
73
-
74
70
  if attributes.key?(:'user_id')
75
71
  self.user_id = attributes[:'user_id']
76
72
  end
77
73
 
74
+ if attributes.key?(:'email_address')
75
+ self.email_address = attributes[:'email_address']
76
+ end
77
+
78
78
  if attributes.key?(:'created_at')
79
79
  self.created_at = attributes[:'created_at']
80
80
  end
@@ -88,14 +88,14 @@ module MailSlurpClient
88
88
  invalid_properties.push('invalid value for "id", id cannot be nil.')
89
89
  end
90
90
 
91
- if @email_address.nil?
92
- invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
93
- end
94
-
95
91
  if @user_id.nil?
96
92
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
97
93
  end
98
94
 
95
+ if @email_address.nil?
96
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
97
+ end
98
+
99
99
  if @created_at.nil?
100
100
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
101
101
  end
@@ -107,8 +107,8 @@ module MailSlurpClient
107
107
  # @return true if the model is valid
108
108
  def valid?
109
109
  return false if @id.nil?
110
- return false if @email_address.nil?
111
110
  return false if @user_id.nil?
111
+ return false if @email_address.nil?
112
112
  return false if @created_at.nil?
113
113
  true
114
114
  end
@@ -119,8 +119,8 @@ module MailSlurpClient
119
119
  return true if self.equal?(o)
120
120
  self.class == o.class &&
121
121
  id == o.id &&
122
- email_address == o.email_address &&
123
122
  user_id == o.user_id &&
123
+ email_address == o.email_address &&
124
124
  created_at == o.created_at
125
125
  end
126
126
 
@@ -133,7 +133,7 @@ module MailSlurpClient
133
133
  # Calculates hash code according to all attributes.
134
134
  # @return [Integer] Hash code
135
135
  def hash
136
- [id, email_address, user_id, created_at].hash
136
+ [id, user_id, email_address, created_at].hash
137
137
  end
138
138
 
139
139
  # Builds the object from hash
@@ -0,0 +1,309 @@
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 ImapSmtpAccessDetails
17
+ attr_accessor :smtp_server_host
18
+
19
+ attr_accessor :smtp_server_port
20
+
21
+ attr_accessor :smtp_username
22
+
23
+ attr_accessor :smtp_password
24
+
25
+ attr_accessor :imap_server_host
26
+
27
+ attr_accessor :imap_server_port
28
+
29
+ attr_accessor :imap_username
30
+
31
+ attr_accessor :imap_password
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'smtp_server_host' => :'smtpServerHost',
37
+ :'smtp_server_port' => :'smtpServerPort',
38
+ :'smtp_username' => :'smtpUsername',
39
+ :'smtp_password' => :'smtpPassword',
40
+ :'imap_server_host' => :'imapServerHost',
41
+ :'imap_server_port' => :'imapServerPort',
42
+ :'imap_username' => :'imapUsername',
43
+ :'imap_password' => :'imapPassword'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'smtp_server_host' => :'String',
51
+ :'smtp_server_port' => :'Integer',
52
+ :'smtp_username' => :'String',
53
+ :'smtp_password' => :'String',
54
+ :'imap_server_host' => :'String',
55
+ :'imap_server_port' => :'Integer',
56
+ :'imap_username' => :'String',
57
+ :'imap_password' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapSmtpAccessDetails` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapSmtpAccessDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'smtp_server_host')
83
+ self.smtp_server_host = attributes[:'smtp_server_host']
84
+ end
85
+
86
+ if attributes.key?(:'smtp_server_port')
87
+ self.smtp_server_port = attributes[:'smtp_server_port']
88
+ end
89
+
90
+ if attributes.key?(:'smtp_username')
91
+ self.smtp_username = attributes[:'smtp_username']
92
+ end
93
+
94
+ if attributes.key?(:'smtp_password')
95
+ self.smtp_password = attributes[:'smtp_password']
96
+ end
97
+
98
+ if attributes.key?(:'imap_server_host')
99
+ self.imap_server_host = attributes[:'imap_server_host']
100
+ end
101
+
102
+ if attributes.key?(:'imap_server_port')
103
+ self.imap_server_port = attributes[:'imap_server_port']
104
+ end
105
+
106
+ if attributes.key?(:'imap_username')
107
+ self.imap_username = attributes[:'imap_username']
108
+ end
109
+
110
+ if attributes.key?(:'imap_password')
111
+ self.imap_password = attributes[:'imap_password']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @smtp_server_host.nil?
120
+ invalid_properties.push('invalid value for "smtp_server_host", smtp_server_host cannot be nil.')
121
+ end
122
+
123
+ if @smtp_server_port.nil?
124
+ invalid_properties.push('invalid value for "smtp_server_port", smtp_server_port cannot be nil.')
125
+ end
126
+
127
+ if @smtp_username.nil?
128
+ invalid_properties.push('invalid value for "smtp_username", smtp_username cannot be nil.')
129
+ end
130
+
131
+ if @smtp_password.nil?
132
+ invalid_properties.push('invalid value for "smtp_password", smtp_password cannot be nil.')
133
+ end
134
+
135
+ if @imap_server_host.nil?
136
+ invalid_properties.push('invalid value for "imap_server_host", imap_server_host cannot be nil.')
137
+ end
138
+
139
+ if @imap_server_port.nil?
140
+ invalid_properties.push('invalid value for "imap_server_port", imap_server_port cannot be nil.')
141
+ end
142
+
143
+ if @imap_username.nil?
144
+ invalid_properties.push('invalid value for "imap_username", imap_username cannot be nil.')
145
+ end
146
+
147
+ if @imap_password.nil?
148
+ invalid_properties.push('invalid value for "imap_password", imap_password cannot be nil.')
149
+ end
150
+
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ return false if @smtp_server_host.nil?
158
+ return false if @smtp_server_port.nil?
159
+ return false if @smtp_username.nil?
160
+ return false if @smtp_password.nil?
161
+ return false if @imap_server_host.nil?
162
+ return false if @imap_server_port.nil?
163
+ return false if @imap_username.nil?
164
+ return false if @imap_password.nil?
165
+ true
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ smtp_server_host == o.smtp_server_host &&
174
+ smtp_server_port == o.smtp_server_port &&
175
+ smtp_username == o.smtp_username &&
176
+ smtp_password == o.smtp_password &&
177
+ imap_server_host == o.imap_server_host &&
178
+ imap_server_port == o.imap_server_port &&
179
+ imap_username == o.imap_username &&
180
+ imap_password == o.imap_password
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [smtp_server_host, smtp_server_port, smtp_username, smtp_password, imap_server_host, imap_server_port, imap_username, imap_password].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ new.build_from_hash(attributes)
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ self.class.openapi_types.each_pair do |key, type|
208
+ if type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :DateTime
229
+ DateTime.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ MailSlurpClient.const_get(type).build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+ end
309
+ end
@@ -0,0 +1,220 @@
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 InboxByEmailAddressResult
17
+ attr_accessor :inbox_id
18
+
19
+ attr_accessor :exists
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'inbox_id' => :'inboxId',
25
+ :'exists' => :'exists'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'inbox_id' => :'String',
33
+ :'exists' => :'Boolean'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InboxByEmailAddressResult` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InboxByEmailAddressResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'inbox_id')
59
+ self.inbox_id = attributes[:'inbox_id']
60
+ end
61
+
62
+ if attributes.key?(:'exists')
63
+ self.exists = attributes[:'exists']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @exists.nil?
72
+ invalid_properties.push('invalid value for "exists", exists cannot be nil.')
73
+ end
74
+
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @exists.nil?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ inbox_id == o.inbox_id &&
91
+ exists == o.exists
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [inbox_id, exists].hash
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 self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ MailSlurpClient.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end