mailslurp_client 15.13.9 → 15.13.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/api_user_controller_api.rb +23 -58
  3. data/lib/mailslurp_client/api/email_controller_api.rb +7 -10
  4. data/lib/mailslurp_client/api/inbox_controller_api.rb +2 -2
  5. data/lib/mailslurp_client/api/webhook_controller_api.rb +108 -0
  6. data/lib/mailslurp_client/models/alias_projection.rb +27 -27
  7. data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
  8. data/lib/mailslurp_client/models/bounce_projection.rb +13 -13
  9. data/lib/mailslurp_client/models/bounce_recipient_projection.rb +13 -13
  10. data/lib/mailslurp_client/models/email_projection.rb +10 -10
  11. data/lib/mailslurp_client/models/page_alias.rb +22 -22
  12. data/lib/mailslurp_client/models/page_attachment_entity.rb +22 -22
  13. data/lib/mailslurp_client/models/page_bounced_email.rb +22 -22
  14. data/lib/mailslurp_client/models/page_bounced_recipients.rb +22 -22
  15. data/lib/mailslurp_client/models/page_complaint.rb +22 -22
  16. data/lib/mailslurp_client/models/page_contact_projection.rb +22 -22
  17. data/lib/mailslurp_client/models/page_delivery_status.rb +22 -22
  18. data/lib/mailslurp_client/models/page_email_preview.rb +22 -22
  19. data/lib/mailslurp_client/models/page_email_projection.rb +22 -22
  20. data/lib/mailslurp_client/models/page_email_validation_request.rb +22 -22
  21. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +22 -22
  22. data/lib/mailslurp_client/models/page_group_projection.rb +22 -22
  23. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +22 -22
  24. data/lib/mailslurp_client/models/page_inbox_projection.rb +22 -22
  25. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +22 -22
  26. data/lib/mailslurp_client/models/page_missed_email_projection.rb +22 -22
  27. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +22 -22
  28. data/lib/mailslurp_client/models/page_phone_number_projection.rb +22 -22
  29. data/lib/mailslurp_client/models/page_sent_email_projection.rb +16 -16
  30. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +16 -16
  31. data/lib/mailslurp_client/models/page_sms_projection.rb +22 -22
  32. data/lib/mailslurp_client/models/page_template_projection.rb +22 -22
  33. data/lib/mailslurp_client/models/page_thread_projection.rb +22 -22
  34. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +22 -22
  35. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +22 -22
  36. data/lib/mailslurp_client/models/page_webhook_projection.rb +22 -22
  37. data/lib/mailslurp_client/models/page_webhook_result.rb +22 -22
  38. data/lib/mailslurp_client/models/phone_number_projection.rb +19 -19
  39. data/lib/mailslurp_client/models/sent_email_projection.rb +15 -15
  40. data/lib/mailslurp_client/models/sort.rb +13 -13
  41. data/lib/mailslurp_client/models/template_projection.rb +15 -15
  42. data/lib/mailslurp_client/models/thread_projection.rb +16 -16
  43. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  44. data/lib/mailslurp_client/models/webhook_delivery_status_payload.rb +429 -0
  45. data/lib/mailslurp_client/models/webhook_new_sms_payload.rb +393 -0
  46. data/lib/mailslurp_client/version.rb +1 -1
  47. data/lib/mailslurp_client.rb +2 -0
  48. metadata +4 -2
@@ -19,10 +19,10 @@ module MailSlurpClient
19
19
 
20
20
  attr_accessor :id
21
21
 
22
- attr_accessor :created_at
23
-
24
22
  attr_accessor :variables
25
23
 
24
+ attr_accessor :created_at
25
+
26
26
  attr_accessor :updated_at
27
27
 
28
28
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -30,8 +30,8 @@ module MailSlurpClient
30
30
  {
31
31
  :'name' => :'name',
32
32
  :'id' => :'id',
33
- :'created_at' => :'createdAt',
34
33
  :'variables' => :'variables',
34
+ :'created_at' => :'createdAt',
35
35
  :'updated_at' => :'updatedAt'
36
36
  }
37
37
  end
@@ -41,8 +41,8 @@ module MailSlurpClient
41
41
  {
42
42
  :'name' => :'String',
43
43
  :'id' => :'String',
44
- :'created_at' => :'DateTime',
45
44
  :'variables' => :'Array<String>',
45
+ :'created_at' => :'DateTime',
46
46
  :'updated_at' => :'DateTime'
47
47
  }
48
48
  end
@@ -76,16 +76,16 @@ module MailSlurpClient
76
76
  self.id = attributes[:'id']
77
77
  end
78
78
 
79
- if attributes.key?(:'created_at')
80
- self.created_at = attributes[:'created_at']
81
- end
82
-
83
79
  if attributes.key?(:'variables')
84
80
  if (value = attributes[:'variables']).is_a?(Array)
85
81
  self.variables = value
86
82
  end
87
83
  end
88
84
 
85
+ if attributes.key?(:'created_at')
86
+ self.created_at = attributes[:'created_at']
87
+ end
88
+
89
89
  if attributes.key?(:'updated_at')
90
90
  self.updated_at = attributes[:'updated_at']
91
91
  end
@@ -103,14 +103,14 @@ module MailSlurpClient
103
103
  invalid_properties.push('invalid value for "id", id cannot be nil.')
104
104
  end
105
105
 
106
- if @created_at.nil?
107
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
108
- end
109
-
110
106
  if @variables.nil?
111
107
  invalid_properties.push('invalid value for "variables", variables cannot be nil.')
112
108
  end
113
109
 
110
+ if @created_at.nil?
111
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
112
+ end
113
+
114
114
  if @updated_at.nil?
115
115
  invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
116
116
  end
@@ -123,8 +123,8 @@ module MailSlurpClient
123
123
  def valid?
124
124
  return false if @name.nil?
125
125
  return false if @id.nil?
126
- return false if @created_at.nil?
127
126
  return false if @variables.nil?
127
+ return false if @created_at.nil?
128
128
  return false if @updated_at.nil?
129
129
  true
130
130
  end
@@ -136,8 +136,8 @@ module MailSlurpClient
136
136
  self.class == o.class &&
137
137
  name == o.name &&
138
138
  id == o.id &&
139
- created_at == o.created_at &&
140
139
  variables == o.variables &&
140
+ created_at == o.created_at &&
141
141
  updated_at == o.updated_at
142
142
  end
143
143
 
@@ -150,7 +150,7 @@ module MailSlurpClient
150
150
  # Calculates hash code according to all attributes.
151
151
  # @return [Integer] Hash code
152
152
  def hash
153
- [name, id, created_at, variables, updated_at].hash
153
+ [name, id, variables, created_at, updated_at].hash
154
154
  end
155
155
 
156
156
  # Builds the object from hash
@@ -24,12 +24,12 @@ module MailSlurpClient
24
24
  # Thread subject
25
25
  attr_accessor :subject
26
26
 
27
- # User ID
28
- attr_accessor :user_id
29
-
30
27
  # Inbox ID
31
28
  attr_accessor :inbox_id
32
29
 
30
+ # User ID
31
+ attr_accessor :user_id
32
+
33
33
  # To recipients
34
34
  attr_accessor :to
35
35
 
@@ -54,8 +54,8 @@ module MailSlurpClient
54
54
  :'name' => :'name',
55
55
  :'id' => :'id',
56
56
  :'subject' => :'subject',
57
- :'user_id' => :'userId',
58
57
  :'inbox_id' => :'inboxId',
58
+ :'user_id' => :'userId',
59
59
  :'to' => :'to',
60
60
  :'bcc' => :'bcc',
61
61
  :'cc' => :'cc',
@@ -71,8 +71,8 @@ module MailSlurpClient
71
71
  :'name' => :'String',
72
72
  :'id' => :'String',
73
73
  :'subject' => :'String',
74
- :'user_id' => :'String',
75
74
  :'inbox_id' => :'String',
75
+ :'user_id' => :'String',
76
76
  :'to' => :'Array<String>',
77
77
  :'bcc' => :'Array<String>',
78
78
  :'cc' => :'Array<String>',
@@ -115,14 +115,14 @@ module MailSlurpClient
115
115
  self.subject = attributes[:'subject']
116
116
  end
117
117
 
118
- if attributes.key?(:'user_id')
119
- self.user_id = attributes[:'user_id']
120
- end
121
-
122
118
  if attributes.key?(:'inbox_id')
123
119
  self.inbox_id = attributes[:'inbox_id']
124
120
  end
125
121
 
122
+ if attributes.key?(:'user_id')
123
+ self.user_id = attributes[:'user_id']
124
+ end
125
+
126
126
  if attributes.key?(:'to')
127
127
  if (value = attributes[:'to']).is_a?(Array)
128
128
  self.to = value
@@ -162,14 +162,14 @@ module MailSlurpClient
162
162
  invalid_properties.push('invalid value for "id", id cannot be nil.')
163
163
  end
164
164
 
165
- if @user_id.nil?
166
- invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
167
- end
168
-
169
165
  if @inbox_id.nil?
170
166
  invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
171
167
  end
172
168
 
169
+ if @user_id.nil?
170
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
171
+ end
172
+
173
173
  if @to.nil?
174
174
  invalid_properties.push('invalid value for "to", to cannot be nil.')
175
175
  end
@@ -193,8 +193,8 @@ module MailSlurpClient
193
193
  # @return true if the model is valid
194
194
  def valid?
195
195
  return false if @id.nil?
196
- return false if @user_id.nil?
197
196
  return false if @inbox_id.nil?
197
+ return false if @user_id.nil?
198
198
  return false if @to.nil?
199
199
  return false if @created_at.nil?
200
200
  return false if @updated_at.nil?
@@ -210,8 +210,8 @@ module MailSlurpClient
210
210
  name == o.name &&
211
211
  id == o.id &&
212
212
  subject == o.subject &&
213
- user_id == o.user_id &&
214
213
  inbox_id == o.inbox_id &&
214
+ user_id == o.user_id &&
215
215
  to == o.to &&
216
216
  bcc == o.bcc &&
217
217
  cc == o.cc &&
@@ -229,7 +229,7 @@ module MailSlurpClient
229
229
  # Calculates hash code according to all attributes.
230
230
  # @return [Integer] Hash code
231
231
  def hash
232
- [name, id, subject, user_id, inbox_id, to, bcc, cc, created_at, updated_at, alias_id].hash
232
+ [name, id, subject, inbox_id, user_id, to, bcc, cc, created_at, updated_at, alias_id].hash
233
233
  end
234
234
 
235
235
  # Builds the object from hash
@@ -19,10 +19,10 @@ module MailSlurpClient
19
19
 
20
20
  attr_accessor :id
21
21
 
22
- attr_accessor :user_id
23
-
24
22
  attr_accessor :inbox_id
25
23
 
24
+ attr_accessor :user_id
25
+
26
26
  attr_accessor :sent_email_id
27
27
 
28
28
  attr_accessor :created_at
@@ -38,8 +38,8 @@ module MailSlurpClient
38
38
  {
39
39
  :'name' => :'name',
40
40
  :'id' => :'id',
41
- :'user_id' => :'userId',
42
41
  :'inbox_id' => :'inboxId',
42
+ :'user_id' => :'userId',
43
43
  :'sent_email_id' => :'sentEmailId',
44
44
  :'created_at' => :'createdAt',
45
45
  :'recipient' => :'recipient',
@@ -53,8 +53,8 @@ module MailSlurpClient
53
53
  {
54
54
  :'name' => :'String',
55
55
  :'id' => :'String',
56
- :'user_id' => :'String',
57
56
  :'inbox_id' => :'String',
57
+ :'user_id' => :'String',
58
58
  :'sent_email_id' => :'String',
59
59
  :'created_at' => :'DateTime',
60
60
  :'recipient' => :'String',
@@ -92,14 +92,14 @@ module MailSlurpClient
92
92
  self.id = attributes[:'id']
93
93
  end
94
94
 
95
- if attributes.key?(:'user_id')
96
- self.user_id = attributes[:'user_id']
97
- end
98
-
99
95
  if attributes.key?(:'inbox_id')
100
96
  self.inbox_id = attributes[:'inbox_id']
101
97
  end
102
98
 
99
+ if attributes.key?(:'user_id')
100
+ self.user_id = attributes[:'user_id']
101
+ end
102
+
103
103
  if attributes.key?(:'sent_email_id')
104
104
  self.sent_email_id = attributes[:'sent_email_id']
105
105
  end
@@ -161,8 +161,8 @@ module MailSlurpClient
161
161
  self.class == o.class &&
162
162
  name == o.name &&
163
163
  id == o.id &&
164
- user_id == o.user_id &&
165
164
  inbox_id == o.inbox_id &&
165
+ user_id == o.user_id &&
166
166
  sent_email_id == o.sent_email_id &&
167
167
  created_at == o.created_at &&
168
168
  recipient == o.recipient &&
@@ -179,7 +179,7 @@ module MailSlurpClient
179
179
  # Calculates hash code according to all attributes.
180
180
  # @return [Integer] Hash code
181
181
  def hash
182
- [name, id, user_id, inbox_id, sent_email_id, created_at, recipient, seen, seen_at].hash
182
+ [name, id, inbox_id, user_id, sent_email_id, created_at, recipient, seen, seen_at].hash
183
183
  end
184
184
 
185
185
  # Builds the object from hash
@@ -0,0 +1,429 @@
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
+ # DELIVERY_STATUS webhook payload. Sent to your webhook url endpoint via HTTP POST when an email delivery status is created. This could be a successful delivery or a delivery failure.
17
+ class WebhookDeliveryStatusPayload
18
+ # Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
19
+ attr_accessor :message_id
20
+
21
+ # ID of webhook entity being triggered
22
+ attr_accessor :webhook_id
23
+
24
+ # Name of the event type webhook is being triggered for.
25
+ attr_accessor :event_name
26
+
27
+ # Name of the webhook being triggered
28
+ attr_accessor :webhook_name
29
+
30
+ # ID of delivery status
31
+ attr_accessor :id
32
+
33
+ # User ID of event
34
+ attr_accessor :user_id
35
+
36
+ # ID of sent email
37
+ attr_accessor :sent_id
38
+
39
+ # IP address of the remote Mail Transfer Agent
40
+ attr_accessor :remote_mta_ip
41
+
42
+ # Id of the inbox
43
+ attr_accessor :inbox_id
44
+
45
+ # Mail Transfer Agent reporting delivery status
46
+ attr_accessor :reporting_mta
47
+
48
+ # Recipients for delivery
49
+ attr_accessor :recipients
50
+
51
+ # SMTP server response message
52
+ attr_accessor :smtp_response
53
+
54
+ # SMTP server status
55
+ attr_accessor :smtp_status_code
56
+
57
+ # Time in milliseconds for delivery processing
58
+ attr_accessor :processing_time_millis
59
+
60
+ # Time event was received
61
+ attr_accessor :received
62
+
63
+ # Email subject
64
+ attr_accessor :subject
65
+
66
+ class EnumAttributeValidator
67
+ attr_reader :datatype
68
+ attr_reader :allowable_values
69
+
70
+ def initialize(datatype, allowable_values)
71
+ @allowable_values = allowable_values.map do |value|
72
+ case datatype.to_s
73
+ when /Integer/i
74
+ value.to_i
75
+ when /Float/i
76
+ value.to_f
77
+ else
78
+ value
79
+ end
80
+ end
81
+ end
82
+
83
+ def valid?(value)
84
+ !value || allowable_values.include?(value)
85
+ end
86
+ end
87
+
88
+ # Attribute mapping from ruby-style variable name to JSON key.
89
+ def self.attribute_map
90
+ {
91
+ :'message_id' => :'messageId',
92
+ :'webhook_id' => :'webhookId',
93
+ :'event_name' => :'eventName',
94
+ :'webhook_name' => :'webhookName',
95
+ :'id' => :'id',
96
+ :'user_id' => :'userId',
97
+ :'sent_id' => :'sentId',
98
+ :'remote_mta_ip' => :'remoteMtaIp',
99
+ :'inbox_id' => :'inboxId',
100
+ :'reporting_mta' => :'reportingMta',
101
+ :'recipients' => :'recipients',
102
+ :'smtp_response' => :'smtpResponse',
103
+ :'smtp_status_code' => :'smtpStatusCode',
104
+ :'processing_time_millis' => :'processingTimeMillis',
105
+ :'received' => :'received',
106
+ :'subject' => :'subject'
107
+ }
108
+ end
109
+
110
+ # Attribute type mapping.
111
+ def self.openapi_types
112
+ {
113
+ :'message_id' => :'String',
114
+ :'webhook_id' => :'String',
115
+ :'event_name' => :'String',
116
+ :'webhook_name' => :'String',
117
+ :'id' => :'String',
118
+ :'user_id' => :'String',
119
+ :'sent_id' => :'String',
120
+ :'remote_mta_ip' => :'String',
121
+ :'inbox_id' => :'String',
122
+ :'reporting_mta' => :'String',
123
+ :'recipients' => :'Array<String>',
124
+ :'smtp_response' => :'String',
125
+ :'smtp_status_code' => :'Integer',
126
+ :'processing_time_millis' => :'Integer',
127
+ :'received' => :'DateTime',
128
+ :'subject' => :'String'
129
+ }
130
+ end
131
+
132
+ # List of attributes with nullable: true
133
+ def self.openapi_nullable
134
+ Set.new([
135
+ :'sent_id',
136
+ :'remote_mta_ip',
137
+ :'inbox_id',
138
+ :'reporting_mta',
139
+ :'recipients',
140
+ :'smtp_response',
141
+ :'smtp_status_code',
142
+ :'processing_time_millis',
143
+ :'received',
144
+ :'subject'
145
+ ])
146
+ end
147
+
148
+ # Initializes the object
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ def initialize(attributes = {})
151
+ if (!attributes.is_a?(Hash))
152
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookDeliveryStatusPayload` initialize method"
153
+ end
154
+
155
+ # check to see if the attribute exists and convert string to symbol for hash key
156
+ attributes = attributes.each_with_object({}) { |(k, v), h|
157
+ if (!self.class.attribute_map.key?(k.to_sym))
158
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookDeliveryStatusPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
159
+ end
160
+ h[k.to_sym] = v
161
+ }
162
+
163
+ if attributes.key?(:'message_id')
164
+ self.message_id = attributes[:'message_id']
165
+ end
166
+
167
+ if attributes.key?(:'webhook_id')
168
+ self.webhook_id = attributes[:'webhook_id']
169
+ end
170
+
171
+ if attributes.key?(:'event_name')
172
+ self.event_name = attributes[:'event_name']
173
+ end
174
+
175
+ if attributes.key?(:'webhook_name')
176
+ self.webhook_name = attributes[:'webhook_name']
177
+ end
178
+
179
+ if attributes.key?(:'id')
180
+ self.id = attributes[:'id']
181
+ end
182
+
183
+ if attributes.key?(:'user_id')
184
+ self.user_id = attributes[:'user_id']
185
+ end
186
+
187
+ if attributes.key?(:'sent_id')
188
+ self.sent_id = attributes[:'sent_id']
189
+ end
190
+
191
+ if attributes.key?(:'remote_mta_ip')
192
+ self.remote_mta_ip = attributes[:'remote_mta_ip']
193
+ end
194
+
195
+ if attributes.key?(:'inbox_id')
196
+ self.inbox_id = attributes[:'inbox_id']
197
+ end
198
+
199
+ if attributes.key?(:'reporting_mta')
200
+ self.reporting_mta = attributes[:'reporting_mta']
201
+ end
202
+
203
+ if attributes.key?(:'recipients')
204
+ if (value = attributes[:'recipients']).is_a?(Array)
205
+ self.recipients = value
206
+ end
207
+ end
208
+
209
+ if attributes.key?(:'smtp_response')
210
+ self.smtp_response = attributes[:'smtp_response']
211
+ end
212
+
213
+ if attributes.key?(:'smtp_status_code')
214
+ self.smtp_status_code = attributes[:'smtp_status_code']
215
+ end
216
+
217
+ if attributes.key?(:'processing_time_millis')
218
+ self.processing_time_millis = attributes[:'processing_time_millis']
219
+ end
220
+
221
+ if attributes.key?(:'received')
222
+ self.received = attributes[:'received']
223
+ end
224
+
225
+ if attributes.key?(:'subject')
226
+ self.subject = attributes[:'subject']
227
+ end
228
+ end
229
+
230
+ # Show invalid properties with the reasons. Usually used together with valid?
231
+ # @return Array for valid properties with the reasons
232
+ def list_invalid_properties
233
+ invalid_properties = Array.new
234
+ if @message_id.nil?
235
+ invalid_properties.push('invalid value for "message_id", message_id cannot be nil.')
236
+ end
237
+
238
+ if @webhook_id.nil?
239
+ invalid_properties.push('invalid value for "webhook_id", webhook_id cannot be nil.')
240
+ end
241
+
242
+ if @event_name.nil?
243
+ invalid_properties.push('invalid value for "event_name", event_name cannot be nil.')
244
+ end
245
+
246
+ if @id.nil?
247
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
248
+ end
249
+
250
+ if @user_id.nil?
251
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
252
+ end
253
+
254
+ invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ return false if @message_id.nil?
261
+ return false if @webhook_id.nil?
262
+ return false if @event_name.nil?
263
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "DELIVERY_STATUS", "BOUNCE", "BOUNCE_RECIPIENT", "NEW_SMS"])
264
+ return false unless event_name_validator.valid?(@event_name)
265
+ return false if @id.nil?
266
+ return false if @user_id.nil?
267
+ true
268
+ end
269
+
270
+ # Custom attribute writer method checking allowed values (enum).
271
+ # @param [Object] event_name Object to be assigned
272
+ def event_name=(event_name)
273
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "DELIVERY_STATUS", "BOUNCE", "BOUNCE_RECIPIENT", "NEW_SMS"])
274
+ unless validator.valid?(event_name)
275
+ fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
276
+ end
277
+ @event_name = event_name
278
+ end
279
+
280
+ # Checks equality by comparing each attribute.
281
+ # @param [Object] Object to be compared
282
+ def ==(o)
283
+ return true if self.equal?(o)
284
+ self.class == o.class &&
285
+ message_id == o.message_id &&
286
+ webhook_id == o.webhook_id &&
287
+ event_name == o.event_name &&
288
+ webhook_name == o.webhook_name &&
289
+ id == o.id &&
290
+ user_id == o.user_id &&
291
+ sent_id == o.sent_id &&
292
+ remote_mta_ip == o.remote_mta_ip &&
293
+ inbox_id == o.inbox_id &&
294
+ reporting_mta == o.reporting_mta &&
295
+ recipients == o.recipients &&
296
+ smtp_response == o.smtp_response &&
297
+ smtp_status_code == o.smtp_status_code &&
298
+ processing_time_millis == o.processing_time_millis &&
299
+ received == o.received &&
300
+ subject == o.subject
301
+ end
302
+
303
+ # @see the `==` method
304
+ # @param [Object] Object to be compared
305
+ def eql?(o)
306
+ self == o
307
+ end
308
+
309
+ # Calculates hash code according to all attributes.
310
+ # @return [Integer] Hash code
311
+ def hash
312
+ [message_id, webhook_id, event_name, webhook_name, id, user_id, sent_id, remote_mta_ip, inbox_id, reporting_mta, recipients, smtp_response, smtp_status_code, processing_time_millis, received, subject].hash
313
+ end
314
+
315
+ # Builds the object from hash
316
+ # @param [Hash] attributes Model attributes in the form of hash
317
+ # @return [Object] Returns the model itself
318
+ def self.build_from_hash(attributes)
319
+ new.build_from_hash(attributes)
320
+ end
321
+
322
+ # Builds the object from hash
323
+ # @param [Hash] attributes Model attributes in the form of hash
324
+ # @return [Object] Returns the model itself
325
+ def build_from_hash(attributes)
326
+ return nil unless attributes.is_a?(Hash)
327
+ self.class.openapi_types.each_pair do |key, type|
328
+ if type =~ /\AArray<(.*)>/i
329
+ # check to ensure the input is an array given that the attribute
330
+ # is documented as an array but the input is not
331
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
332
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
333
+ end
334
+ elsif !attributes[self.class.attribute_map[key]].nil?
335
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
336
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
337
+ end
338
+
339
+ self
340
+ end
341
+
342
+ # Deserializes the data based on type
343
+ # @param string type Data type
344
+ # @param string value Value to be deserialized
345
+ # @return [Object] Deserialized data
346
+ def _deserialize(type, value)
347
+ case type.to_sym
348
+ when :DateTime
349
+ DateTime.parse(value)
350
+ when :Date
351
+ Date.parse(value)
352
+ when :String
353
+ value.to_s
354
+ when :Integer
355
+ value.to_i
356
+ when :Float
357
+ value.to_f
358
+ when :Boolean
359
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
360
+ true
361
+ else
362
+ false
363
+ end
364
+ when :Object
365
+ # generic object (usually a Hash), return directly
366
+ value
367
+ when /\AArray<(?<inner_type>.+)>\z/
368
+ inner_type = Regexp.last_match[:inner_type]
369
+ value.map { |v| _deserialize(inner_type, v) }
370
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
371
+ k_type = Regexp.last_match[:k_type]
372
+ v_type = Regexp.last_match[:v_type]
373
+ {}.tap do |hash|
374
+ value.each do |k, v|
375
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
376
+ end
377
+ end
378
+ else # model
379
+ MailSlurpClient.const_get(type).build_from_hash(value)
380
+ end
381
+ end
382
+
383
+ # Returns the string representation of the object
384
+ # @return [String] String presentation of the object
385
+ def to_s
386
+ to_hash.to_s
387
+ end
388
+
389
+ # to_body is an alias to to_hash (backward compatibility)
390
+ # @return [Hash] Returns the object in the form of hash
391
+ def to_body
392
+ to_hash
393
+ end
394
+
395
+ # Returns the object in the form of hash
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_hash
398
+ hash = {}
399
+ self.class.attribute_map.each_pair do |attr, param|
400
+ value = self.send(attr)
401
+ if value.nil?
402
+ is_nullable = self.class.openapi_nullable.include?(attr)
403
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
404
+ end
405
+
406
+ hash[param] = _to_hash(value)
407
+ end
408
+ hash
409
+ end
410
+
411
+ # Outputs non-array value in the form of hash
412
+ # For object, use to_hash. Otherwise, just return the value
413
+ # @param [Object] value Any valid value
414
+ # @return [Hash] Returns the value in the form of hash
415
+ def _to_hash(value)
416
+ if value.is_a?(Array)
417
+ value.compact.map { |v| _to_hash(v) }
418
+ elsif value.is_a?(Hash)
419
+ {}.tap do |hash|
420
+ value.each { |k, v| hash[k] = _to_hash(v) }
421
+ end
422
+ elsif value.respond_to? :to_hash
423
+ value.to_hash
424
+ else
425
+ value
426
+ end
427
+ end
428
+ end
429
+ end