mailslurp_client 15.17.41 → 15.18.0

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/email_controller_api.rb +62 -0
  3. data/lib/mailslurp_client/api/tools_controller_api.rb +175 -0
  4. data/lib/mailslurp_client/models/alias_projection.rb +39 -39
  5. data/lib/mailslurp_client/models/attachment_projection.rb +29 -29
  6. data/lib/mailslurp_client/models/bounce_projection.rb +15 -15
  7. data/lib/mailslurp_client/models/bounce_recipient_projection.rb +15 -15
  8. data/lib/mailslurp_client/models/check_email_body_results.rb +259 -0
  9. data/lib/mailslurp_client/models/connector_projection.rb +24 -24
  10. data/lib/mailslurp_client/models/connector_sync_event_projection.rb +15 -15
  11. data/lib/mailslurp_client/models/contact_projection.rb +10 -10
  12. data/lib/mailslurp_client/models/email_projection.rb +21 -21
  13. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +19 -19
  14. data/lib/mailslurp_client/models/fake_email_dto.rb +305 -0
  15. data/lib/mailslurp_client/models/fake_email_preview.rb +291 -0
  16. data/lib/mailslurp_client/models/fake_email_result.rb +206 -0
  17. data/lib/mailslurp_client/models/image_issue.rb +282 -0
  18. data/lib/mailslurp_client/models/imap_smtp_access_details.rb +15 -4
  19. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +20 -20
  20. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +20 -20
  21. data/lib/mailslurp_client/models/link_issue.rb +282 -0
  22. data/lib/mailslurp_client/models/list_unsubscribe_recipient_projection.rb +15 -15
  23. data/lib/mailslurp_client/models/missed_email_projection.rb +10 -10
  24. data/lib/mailslurp_client/models/new_fake_email_address_result.rb +211 -0
  25. data/lib/mailslurp_client/models/phone_number_projection.rb +15 -15
  26. data/lib/mailslurp_client/models/sent_email_projection.rb +44 -44
  27. data/lib/mailslurp_client/models/sms_projection.rb +29 -29
  28. data/lib/mailslurp_client/models/spelling_issue.rb +287 -0
  29. data/lib/mailslurp_client/models/template_projection.rb +17 -17
  30. data/lib/mailslurp_client/models/thread_projection.rb +41 -41
  31. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +27 -27
  32. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +10 -10
  33. data/lib/mailslurp_client/models/webhook_projection.rb +25 -25
  34. data/lib/mailslurp_client/version.rb +1 -1
  35. data/lib/mailslurp_client.rb +8 -0
  36. metadata +10 -2
@@ -15,8 +15,6 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Email contact for address book
17
17
  class ContactProjection
18
- attr_accessor :created_at
19
-
20
18
  attr_accessor :email_address
21
19
 
22
20
  attr_accessor :email_addresses
@@ -29,6 +27,8 @@ module MailSlurpClient
29
27
 
30
28
  attr_accessor :opt_out
31
29
 
30
+ attr_accessor :created_at
31
+
32
32
  attr_accessor :id
33
33
 
34
34
  attr_accessor :group_id
@@ -36,13 +36,13 @@ module MailSlurpClient
36
36
  # Attribute mapping from ruby-style variable name to JSON key.
37
37
  def self.attribute_map
38
38
  {
39
- :'created_at' => :'createdAt',
40
39
  :'email_address' => :'emailAddress',
41
40
  :'email_addresses' => :'emailAddresses',
42
41
  :'first_name' => :'firstName',
43
42
  :'last_name' => :'lastName',
44
43
  :'company' => :'company',
45
44
  :'opt_out' => :'optOut',
45
+ :'created_at' => :'createdAt',
46
46
  :'id' => :'id',
47
47
  :'group_id' => :'groupId'
48
48
  }
@@ -51,13 +51,13 @@ module MailSlurpClient
51
51
  # Attribute type mapping.
52
52
  def self.openapi_types
53
53
  {
54
- :'created_at' => :'DateTime',
55
54
  :'email_address' => :'String',
56
55
  :'email_addresses' => :'Array<String>',
57
56
  :'first_name' => :'String',
58
57
  :'last_name' => :'String',
59
58
  :'company' => :'String',
60
59
  :'opt_out' => :'Boolean',
60
+ :'created_at' => :'DateTime',
61
61
  :'id' => :'String',
62
62
  :'group_id' => :'String'
63
63
  }
@@ -91,10 +91,6 @@ module MailSlurpClient
91
91
  h[k.to_sym] = v
92
92
  }
93
93
 
94
- if attributes.key?(:'created_at')
95
- self.created_at = attributes[:'created_at']
96
- end
97
-
98
94
  if attributes.key?(:'email_address')
99
95
  self.email_address = attributes[:'email_address']
100
96
  end
@@ -121,6 +117,10 @@ module MailSlurpClient
121
117
  self.opt_out = attributes[:'opt_out']
122
118
  end
123
119
 
120
+ if attributes.key?(:'created_at')
121
+ self.created_at = attributes[:'created_at']
122
+ end
123
+
124
124
  if attributes.key?(:'id')
125
125
  self.id = attributes[:'id']
126
126
  end
@@ -158,13 +158,13 @@ module MailSlurpClient
158
158
  def ==(o)
159
159
  return true if self.equal?(o)
160
160
  self.class == o.class &&
161
- created_at == o.created_at &&
162
161
  email_address == o.email_address &&
163
162
  email_addresses == o.email_addresses &&
164
163
  first_name == o.first_name &&
165
164
  last_name == o.last_name &&
166
165
  company == o.company &&
167
166
  opt_out == o.opt_out &&
167
+ created_at == o.created_at &&
168
168
  id == o.id &&
169
169
  group_id == o.group_id
170
170
  end
@@ -178,7 +178,7 @@ module MailSlurpClient
178
178
  # Calculates hash code according to all attributes.
179
179
  # @return [Integer] Hash code
180
180
  def hash
181
- [created_at, email_address, email_addresses, first_name, last_name, company, opt_out, id, group_id].hash
181
+ [email_address, email_addresses, first_name, last_name, company, opt_out, created_at, id, group_id].hash
182
182
  end
183
183
 
184
184
  # Builds the object from hash
@@ -15,12 +15,10 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # A compact representation of a full email. Used in list endpoints to keep response sizes low. Body and attachments are not included. To get all fields of the email use the `getEmail` method with the email projection's ID. See `EmailDto` for documentation on projection properties.
17
17
  class EmailProjection
18
- attr_accessor :created_at
18
+ attr_accessor :inbox_id
19
19
 
20
20
  attr_accessor :attachments
21
21
 
22
- attr_accessor :inbox_id
23
-
24
22
  attr_accessor :to
25
23
 
26
24
  attr_accessor :domain_id
@@ -39,6 +37,8 @@ module MailSlurpClient
39
37
 
40
38
  attr_accessor :text_excerpt
41
39
 
40
+ attr_accessor :created_at
41
+
42
42
  attr_accessor :subject
43
43
 
44
44
  attr_accessor :id
@@ -48,9 +48,8 @@ module MailSlurpClient
48
48
  # Attribute mapping from ruby-style variable name to JSON key.
49
49
  def self.attribute_map
50
50
  {
51
- :'created_at' => :'createdAt',
52
- :'attachments' => :'attachments',
53
51
  :'inbox_id' => :'inboxId',
52
+ :'attachments' => :'attachments',
54
53
  :'to' => :'to',
55
54
  :'domain_id' => :'domainId',
56
55
  :'bcc' => :'bcc',
@@ -60,6 +59,7 @@ module MailSlurpClient
60
59
  :'team_access' => :'teamAccess',
61
60
  :'body_md5_hash' => :'bodyMD5Hash',
62
61
  :'text_excerpt' => :'textExcerpt',
62
+ :'created_at' => :'createdAt',
63
63
  :'subject' => :'subject',
64
64
  :'id' => :'id',
65
65
  :'from' => :'from'
@@ -69,9 +69,8 @@ module MailSlurpClient
69
69
  # Attribute type mapping.
70
70
  def self.openapi_types
71
71
  {
72
- :'created_at' => :'DateTime',
73
- :'attachments' => :'Array<String>',
74
72
  :'inbox_id' => :'String',
73
+ :'attachments' => :'Array<String>',
75
74
  :'to' => :'Array<String>',
76
75
  :'domain_id' => :'String',
77
76
  :'bcc' => :'Array<String>',
@@ -81,6 +80,7 @@ module MailSlurpClient
81
80
  :'team_access' => :'Boolean',
82
81
  :'body_md5_hash' => :'String',
83
82
  :'text_excerpt' => :'String',
83
+ :'created_at' => :'DateTime',
84
84
  :'subject' => :'String',
85
85
  :'id' => :'String',
86
86
  :'from' => :'String'
@@ -117,8 +117,8 @@ module MailSlurpClient
117
117
  h[k.to_sym] = v
118
118
  }
119
119
 
120
- if attributes.key?(:'created_at')
121
- self.created_at = attributes[:'created_at']
120
+ if attributes.key?(:'inbox_id')
121
+ self.inbox_id = attributes[:'inbox_id']
122
122
  end
123
123
 
124
124
  if attributes.key?(:'attachments')
@@ -127,10 +127,6 @@ module MailSlurpClient
127
127
  end
128
128
  end
129
129
 
130
- if attributes.key?(:'inbox_id')
131
- self.inbox_id = attributes[:'inbox_id']
132
- end
133
-
134
130
  if attributes.key?(:'to')
135
131
  if (value = attributes[:'to']).is_a?(Array)
136
132
  self.to = value
@@ -173,6 +169,10 @@ module MailSlurpClient
173
169
  self.text_excerpt = attributes[:'text_excerpt']
174
170
  end
175
171
 
172
+ if attributes.key?(:'created_at')
173
+ self.created_at = attributes[:'created_at']
174
+ end
175
+
176
176
  if attributes.key?(:'subject')
177
177
  self.subject = attributes[:'subject']
178
178
  end
@@ -190,10 +190,6 @@ module MailSlurpClient
190
190
  # @return Array for valid properties with the reasons
191
191
  def list_invalid_properties
192
192
  invalid_properties = Array.new
193
- if @created_at.nil?
194
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
195
- end
196
-
197
193
  if @inbox_id.nil?
198
194
  invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
199
195
  end
@@ -210,6 +206,10 @@ module MailSlurpClient
210
206
  invalid_properties.push('invalid value for "team_access", team_access cannot be nil.')
211
207
  end
212
208
 
209
+ if @created_at.nil?
210
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
211
+ end
212
+
213
213
  if @id.nil?
214
214
  invalid_properties.push('invalid value for "id", id cannot be nil.')
215
215
  end
@@ -220,11 +220,11 @@ module MailSlurpClient
220
220
  # Check to see if the all the properties in the model are valid
221
221
  # @return true if the model is valid
222
222
  def valid?
223
- return false if @created_at.nil?
224
223
  return false if @inbox_id.nil?
225
224
  return false if @to.nil?
226
225
  return false if @read.nil?
227
226
  return false if @team_access.nil?
227
+ return false if @created_at.nil?
228
228
  return false if @id.nil?
229
229
  true
230
230
  end
@@ -234,9 +234,8 @@ module MailSlurpClient
234
234
  def ==(o)
235
235
  return true if self.equal?(o)
236
236
  self.class == o.class &&
237
- created_at == o.created_at &&
238
- attachments == o.attachments &&
239
237
  inbox_id == o.inbox_id &&
238
+ attachments == o.attachments &&
240
239
  to == o.to &&
241
240
  domain_id == o.domain_id &&
242
241
  bcc == o.bcc &&
@@ -246,6 +245,7 @@ module MailSlurpClient
246
245
  team_access == o.team_access &&
247
246
  body_md5_hash == o.body_md5_hash &&
248
247
  text_excerpt == o.text_excerpt &&
248
+ created_at == o.created_at &&
249
249
  subject == o.subject &&
250
250
  id == o.id &&
251
251
  from == o.from
@@ -260,7 +260,7 @@ module MailSlurpClient
260
260
  # Calculates hash code according to all attributes.
261
261
  # @return [Integer] Hash code
262
262
  def hash
263
- [created_at, attachments, inbox_id, to, domain_id, bcc, cc, read, body_excerpt, team_access, body_md5_hash, text_excerpt, subject, id, from].hash
263
+ [inbox_id, attachments, to, domain_id, bcc, cc, read, body_excerpt, team_access, body_md5_hash, text_excerpt, created_at, subject, id, from].hash
264
264
  end
265
265
 
266
266
  # Builds the object from hash
@@ -15,20 +15,20 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Record of inbox expiration
17
17
  class ExpiredInboxRecordProjection
18
- attr_accessor :created_at
18
+ attr_accessor :user_id
19
19
 
20
20
  attr_accessor :email_address
21
21
 
22
- attr_accessor :user_id
22
+ attr_accessor :created_at
23
23
 
24
24
  attr_accessor :id
25
25
 
26
26
  # Attribute mapping from ruby-style variable name to JSON key.
27
27
  def self.attribute_map
28
28
  {
29
- :'created_at' => :'createdAt',
30
- :'email_address' => :'emailAddress',
31
29
  :'user_id' => :'userId',
30
+ :'email_address' => :'emailAddress',
31
+ :'created_at' => :'createdAt',
32
32
  :'id' => :'id'
33
33
  }
34
34
  end
@@ -36,9 +36,9 @@ module MailSlurpClient
36
36
  # Attribute type mapping.
37
37
  def self.openapi_types
38
38
  {
39
- :'created_at' => :'DateTime',
40
- :'email_address' => :'String',
41
39
  :'user_id' => :'String',
40
+ :'email_address' => :'String',
41
+ :'created_at' => :'DateTime',
42
42
  :'id' => :'String'
43
43
  }
44
44
  end
@@ -64,16 +64,16 @@ module MailSlurpClient
64
64
  h[k.to_sym] = v
65
65
  }
66
66
 
67
- if attributes.key?(:'created_at')
68
- self.created_at = attributes[:'created_at']
67
+ if attributes.key?(:'user_id')
68
+ self.user_id = attributes[:'user_id']
69
69
  end
70
70
 
71
71
  if attributes.key?(:'email_address')
72
72
  self.email_address = attributes[:'email_address']
73
73
  end
74
74
 
75
- if attributes.key?(:'user_id')
76
- self.user_id = attributes[:'user_id']
75
+ if attributes.key?(:'created_at')
76
+ self.created_at = attributes[:'created_at']
77
77
  end
78
78
 
79
79
  if attributes.key?(:'id')
@@ -85,16 +85,16 @@ module MailSlurpClient
85
85
  # @return Array for valid properties with the reasons
86
86
  def list_invalid_properties
87
87
  invalid_properties = Array.new
88
- if @created_at.nil?
89
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
88
+ if @user_id.nil?
89
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
90
90
  end
91
91
 
92
92
  if @email_address.nil?
93
93
  invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
94
94
  end
95
95
 
96
- if @user_id.nil?
97
- invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
96
+ if @created_at.nil?
97
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
98
98
  end
99
99
 
100
100
  if @id.nil?
@@ -107,9 +107,9 @@ module MailSlurpClient
107
107
  # Check to see if the all the properties in the model are valid
108
108
  # @return true if the model is valid
109
109
  def valid?
110
- return false if @created_at.nil?
111
- return false if @email_address.nil?
112
110
  return false if @user_id.nil?
111
+ return false if @email_address.nil?
112
+ return false if @created_at.nil?
113
113
  return false if @id.nil?
114
114
  true
115
115
  end
@@ -119,9 +119,9 @@ module MailSlurpClient
119
119
  def ==(o)
120
120
  return true if self.equal?(o)
121
121
  self.class == o.class &&
122
- created_at == o.created_at &&
123
- email_address == o.email_address &&
124
122
  user_id == o.user_id &&
123
+ email_address == o.email_address &&
124
+ created_at == o.created_at &&
125
125
  id == o.id
126
126
  end
127
127
 
@@ -134,7 +134,7 @@ module MailSlurpClient
134
134
  # Calculates hash code according to all attributes.
135
135
  # @return [Integer] Hash code
136
136
  def hash
137
- [created_at, email_address, user_id, id].hash
137
+ [user_id, email_address, created_at, id].hash
138
138
  end
139
139
 
140
140
  # Builds the object from hash
@@ -0,0 +1,305 @@
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://docs.mailslurp.com/) - [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 FakeEmailDto
17
+ attr_accessor :id
18
+
19
+ attr_accessor :email_address
20
+
21
+ attr_accessor :sender
22
+
23
+ attr_accessor :recipients
24
+
25
+ attr_accessor :subject
26
+
27
+ attr_accessor :preview
28
+
29
+ attr_accessor :body
30
+
31
+ attr_accessor :seen
32
+
33
+ attr_accessor :created_at
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'id' => :'id',
39
+ :'email_address' => :'emailAddress',
40
+ :'sender' => :'sender',
41
+ :'recipients' => :'recipients',
42
+ :'subject' => :'subject',
43
+ :'preview' => :'preview',
44
+ :'body' => :'body',
45
+ :'seen' => :'seen',
46
+ :'created_at' => :'createdAt'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'id' => :'String',
54
+ :'email_address' => :'String',
55
+ :'sender' => :'Sender',
56
+ :'recipients' => :'EmailRecipients',
57
+ :'subject' => :'String',
58
+ :'preview' => :'String',
59
+ :'body' => :'String',
60
+ :'seen' => :'Boolean',
61
+ :'created_at' => :'DateTime'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ :'sender',
69
+ :'recipients',
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::FakeEmailDto` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::FakeEmailDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'id')
89
+ self.id = attributes[:'id']
90
+ end
91
+
92
+ if attributes.key?(:'email_address')
93
+ self.email_address = attributes[:'email_address']
94
+ end
95
+
96
+ if attributes.key?(:'sender')
97
+ self.sender = attributes[:'sender']
98
+ end
99
+
100
+ if attributes.key?(:'recipients')
101
+ self.recipients = attributes[:'recipients']
102
+ end
103
+
104
+ if attributes.key?(:'subject')
105
+ self.subject = attributes[:'subject']
106
+ end
107
+
108
+ if attributes.key?(:'preview')
109
+ self.preview = attributes[:'preview']
110
+ end
111
+
112
+ if attributes.key?(:'body')
113
+ self.body = attributes[:'body']
114
+ end
115
+
116
+ if attributes.key?(:'seen')
117
+ self.seen = attributes[:'seen']
118
+ end
119
+
120
+ if attributes.key?(:'created_at')
121
+ self.created_at = attributes[:'created_at']
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ invalid_properties = Array.new
129
+ if @id.nil?
130
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
131
+ end
132
+
133
+ if @email_address.nil?
134
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
135
+ end
136
+
137
+ if @body.nil?
138
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
139
+ end
140
+
141
+ if @seen.nil?
142
+ invalid_properties.push('invalid value for "seen", seen cannot be nil.')
143
+ end
144
+
145
+ if @created_at.nil?
146
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ return false if @id.nil?
156
+ return false if @email_address.nil?
157
+ return false if @body.nil?
158
+ return false if @seen.nil?
159
+ return false if @created_at.nil?
160
+ true
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ id == o.id &&
169
+ email_address == o.email_address &&
170
+ sender == o.sender &&
171
+ recipients == o.recipients &&
172
+ subject == o.subject &&
173
+ preview == o.preview &&
174
+ body == o.body &&
175
+ seen == o.seen &&
176
+ created_at == o.created_at
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Integer] Hash code
187
+ def hash
188
+ [id, email_address, sender, recipients, subject, preview, body, seen, created_at].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def self.build_from_hash(attributes)
195
+ new.build_from_hash(attributes)
196
+ end
197
+
198
+ # Builds the object from hash
199
+ # @param [Hash] attributes Model attributes in the form of hash
200
+ # @return [Object] Returns the model itself
201
+ def build_from_hash(attributes)
202
+ return nil unless attributes.is_a?(Hash)
203
+ self.class.openapi_types.each_pair do |key, type|
204
+ if type =~ /\AArray<(.*)>/i
205
+ # check to ensure the input is an array given that the attribute
206
+ # is documented as an array but the input is not
207
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
208
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
209
+ end
210
+ elsif !attributes[self.class.attribute_map[key]].nil?
211
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
212
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
213
+ end
214
+
215
+ self
216
+ end
217
+
218
+ # Deserializes the data based on type
219
+ # @param string type Data type
220
+ # @param string value Value to be deserialized
221
+ # @return [Object] Deserialized data
222
+ def _deserialize(type, value)
223
+ case type.to_sym
224
+ when :DateTime
225
+ DateTime.parse(value)
226
+ when :Date
227
+ Date.parse(value)
228
+ when :String
229
+ value.to_s
230
+ when :Integer
231
+ value.to_i
232
+ when :Float
233
+ value.to_f
234
+ when :Boolean
235
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
+ true
237
+ else
238
+ false
239
+ end
240
+ when :Object
241
+ # generic object (usually a Hash), return directly
242
+ value
243
+ when /\AArray<(?<inner_type>.+)>\z/
244
+ inner_type = Regexp.last_match[:inner_type]
245
+ value.map { |v| _deserialize(inner_type, v) }
246
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
247
+ k_type = Regexp.last_match[:k_type]
248
+ v_type = Regexp.last_match[:v_type]
249
+ {}.tap do |hash|
250
+ value.each do |k, v|
251
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
252
+ end
253
+ end
254
+ else # model
255
+ MailSlurpClient.const_get(type).build_from_hash(value)
256
+ end
257
+ end
258
+
259
+ # Returns the string representation of the object
260
+ # @return [String] String presentation of the object
261
+ def to_s
262
+ to_hash.to_s
263
+ end
264
+
265
+ # to_body is an alias to to_hash (backward compatibility)
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_body
268
+ to_hash
269
+ end
270
+
271
+ # Returns the object in the form of hash
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_hash
274
+ hash = {}
275
+ self.class.attribute_map.each_pair do |attr, param|
276
+ value = self.send(attr)
277
+ if value.nil?
278
+ is_nullable = self.class.openapi_nullable.include?(attr)
279
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
280
+ end
281
+
282
+ hash[param] = _to_hash(value)
283
+ end
284
+ hash
285
+ end
286
+
287
+ # Outputs non-array value in the form of hash
288
+ # For object, use to_hash. Otherwise, just return the value
289
+ # @param [Object] value Any valid value
290
+ # @return [Hash] Returns the value in the form of hash
291
+ def _to_hash(value)
292
+ if value.is_a?(Array)
293
+ value.compact.map { |v| _to_hash(v) }
294
+ elsif value.is_a?(Hash)
295
+ {}.tap do |hash|
296
+ value.each { |k, v| hash[k] = _to_hash(v) }
297
+ end
298
+ elsif value.respond_to? :to_hash
299
+ value.to_hash
300
+ else
301
+ value
302
+ end
303
+ end
304
+ end
305
+ end