mailslurp_client 12.0.0 → 12.1.24

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.
@@ -30,6 +30,9 @@ module MailSlurpClient
30
30
  # To recipients for forwarded email
31
31
  attr_accessor :to
32
32
 
33
+ # Optionally use inbox name as display name for sender email address
34
+ attr_accessor :use_inbox_name
35
+
33
36
  # Attribute mapping from ruby-style variable name to JSON key.
34
37
  def self.attribute_map
35
38
  {
@@ -37,7 +40,8 @@ module MailSlurpClient
37
40
  :'cc' => :'cc',
38
41
  :'from' => :'from',
39
42
  :'subject' => :'subject',
40
- :'to' => :'to'
43
+ :'to' => :'to',
44
+ :'use_inbox_name' => :'useInboxName'
41
45
  }
42
46
  end
43
47
 
@@ -48,7 +52,8 @@ module MailSlurpClient
48
52
  :'cc' => :'Array<String>',
49
53
  :'from' => :'String',
50
54
  :'subject' => :'String',
51
- :'to' => :'Array<String>'
55
+ :'to' => :'Array<String>',
56
+ :'use_inbox_name' => :'Boolean'
52
57
  }
53
58
  end
54
59
 
@@ -98,6 +103,10 @@ module MailSlurpClient
98
103
  self.to = value
99
104
  end
100
105
  end
106
+
107
+ if attributes.key?(:'use_inbox_name')
108
+ self.use_inbox_name = attributes[:'use_inbox_name']
109
+ end
101
110
  end
102
111
 
103
112
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -122,7 +131,8 @@ module MailSlurpClient
122
131
  cc == o.cc &&
123
132
  from == o.from &&
124
133
  subject == o.subject &&
125
- to == o.to
134
+ to == o.to &&
135
+ use_inbox_name == o.use_inbox_name
126
136
  end
127
137
 
128
138
  # @see the `==` method
@@ -134,7 +144,7 @@ module MailSlurpClient
134
144
  # Calculates hash code according to all attributes.
135
145
  # @return [Integer] Hash code
136
146
  def hash
137
- [bcc, cc, from, subject, to].hash
147
+ [bcc, cc, from, subject, to, use_inbox_name].hash
138
148
  end
139
149
 
140
150
  # Builds the object from hash
@@ -13,14 +13,18 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Optional filter for matching emails based on fields. For instance filter results to only include emails whose `SUBJECT` value does `CONTAIN` given match value. An example payload would be `{ matches: [{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }] }`. If you wish to extract regex matches inside the email content see the `getEmailContentMatch` method in the EmailController.
16
+ # Optional filter for matching emails based on fields. For instance filter results to only include emails whose `SUBJECT` value does `CONTAIN` given match value. An example payload would be `{ matches: [{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }] }`. You can also pass conditions such as `HAS_ATTACHMENT`. If you wish to extract regex matches inside the email content see the `getEmailContentMatch` method in the EmailController.
17
17
  class MatchOptions
18
- # 1 or more match options. Options are additive so if one does not match the email is excluded from results
18
+ # Zero or more conditions such as `{ condition: 'HAS_ATTACHMENTS', value: 'TRUE' }`. Note the values are the strings `TRUE|FALSE` not booleans.
19
+ attr_accessor :conditions
20
+
21
+ # Zero or more match options such as `{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }`. Options are additive so if one does not match the email is excluded from results
19
22
  attr_accessor :matches
20
23
 
21
24
  # Attribute mapping from ruby-style variable name to JSON key.
22
25
  def self.attribute_map
23
26
  {
27
+ :'conditions' => :'conditions',
24
28
  :'matches' => :'matches'
25
29
  }
26
30
  end
@@ -28,6 +32,7 @@ module MailSlurpClient
28
32
  # Attribute type mapping.
29
33
  def self.openapi_types
30
34
  {
35
+ :'conditions' => :'Array<ConditionOption>',
31
36
  :'matches' => :'Array<MatchOption>'
32
37
  }
33
38
  end
@@ -53,6 +58,12 @@ module MailSlurpClient
53
58
  h[k.to_sym] = v
54
59
  }
55
60
 
61
+ if attributes.key?(:'conditions')
62
+ if (value = attributes[:'conditions']).is_a?(Array)
63
+ self.conditions = value
64
+ end
65
+ end
66
+
56
67
  if attributes.key?(:'matches')
57
68
  if (value = attributes[:'matches']).is_a?(Array)
58
69
  self.matches = value
@@ -78,6 +89,7 @@ module MailSlurpClient
78
89
  def ==(o)
79
90
  return true if self.equal?(o)
80
91
  self.class == o.class &&
92
+ conditions == o.conditions &&
81
93
  matches == o.matches
82
94
  end
83
95
 
@@ -90,7 +102,7 @@ module MailSlurpClient
90
102
  # Calculates hash code according to all attributes.
91
103
  # @return [Integer] Hash code
92
104
  def hash
93
- [matches].hash
105
+ [conditions, matches].hash
94
106
  end
95
107
 
96
108
  # Builds the object from hash
@@ -36,6 +36,9 @@ module MailSlurpClient
36
36
  # Template variables if using a template
37
37
  attr_accessor :template_variables
38
38
 
39
+ # Optionally use inbox name as display name for sender email address
40
+ attr_accessor :use_inbox_name
41
+
39
42
  class EnumAttributeValidator
40
43
  attr_reader :datatype
41
44
  attr_reader :allowable_values
@@ -67,7 +70,8 @@ module MailSlurpClient
67
70
  :'is_html' => :'isHTML',
68
71
  :'send_strategy' => :'sendStrategy',
69
72
  :'template' => :'template',
70
- :'template_variables' => :'templateVariables'
73
+ :'template_variables' => :'templateVariables',
74
+ :'use_inbox_name' => :'useInboxName'
71
75
  }
72
76
  end
73
77
 
@@ -80,7 +84,8 @@ module MailSlurpClient
80
84
  :'is_html' => :'Boolean',
81
85
  :'send_strategy' => :'String',
82
86
  :'template' => :'String',
83
- :'template_variables' => :'Object'
87
+ :'template_variables' => :'Object',
88
+ :'use_inbox_name' => :'Boolean'
84
89
  }
85
90
  end
86
91
 
@@ -134,6 +139,10 @@ module MailSlurpClient
134
139
  if attributes.key?(:'template_variables')
135
140
  self.template_variables = attributes[:'template_variables']
136
141
  end
142
+
143
+ if attributes.key?(:'use_inbox_name')
144
+ self.use_inbox_name = attributes[:'use_inbox_name']
145
+ end
137
146
  end
138
147
 
139
148
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -172,7 +181,8 @@ module MailSlurpClient
172
181
  is_html == o.is_html &&
173
182
  send_strategy == o.send_strategy &&
174
183
  template == o.template &&
175
- template_variables == o.template_variables
184
+ template_variables == o.template_variables &&
185
+ use_inbox_name == o.use_inbox_name
176
186
  end
177
187
 
178
188
  # @see the `==` method
@@ -184,7 +194,7 @@ module MailSlurpClient
184
194
  # Calculates hash code according to all attributes.
185
195
  # @return [Integer] Hash code
186
196
  def hash
187
- [attachments, body, charset, is_html, send_strategy, template, template_variables].hash
197
+ [attachments, body, charset, is_html, send_strategy, template, template_variables, use_inbox_name].hash
188
198
  end
189
199
 
190
200
  # Builds the object from hash
@@ -42,6 +42,9 @@ module MailSlurpClient
42
42
  # Template variables if using a template
43
43
  attr_accessor :template_variables
44
44
 
45
+ # Optionally use inbox name as display name for sender email address
46
+ attr_accessor :use_inbox_name
47
+
45
48
  class EnumAttributeValidator
46
49
  attr_reader :datatype
47
50
  attr_reader :allowable_values
@@ -75,7 +78,8 @@ module MailSlurpClient
75
78
  :'reply_to' => :'replyTo',
76
79
  :'send_strategy' => :'sendStrategy',
77
80
  :'template' => :'template',
78
- :'template_variables' => :'templateVariables'
81
+ :'template_variables' => :'templateVariables',
82
+ :'use_inbox_name' => :'useInboxName'
79
83
  }
80
84
  end
81
85
 
@@ -90,7 +94,8 @@ module MailSlurpClient
90
94
  :'reply_to' => :'String',
91
95
  :'send_strategy' => :'String',
92
96
  :'template' => :'String',
93
- :'template_variables' => :'Object'
97
+ :'template_variables' => :'Object',
98
+ :'use_inbox_name' => :'Boolean'
94
99
  }
95
100
  end
96
101
 
@@ -152,6 +157,10 @@ module MailSlurpClient
152
157
  if attributes.key?(:'template_variables')
153
158
  self.template_variables = attributes[:'template_variables']
154
159
  end
160
+
161
+ if attributes.key?(:'use_inbox_name')
162
+ self.use_inbox_name = attributes[:'use_inbox_name']
163
+ end
155
164
  end
156
165
 
157
166
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -192,7 +201,8 @@ module MailSlurpClient
192
201
  reply_to == o.reply_to &&
193
202
  send_strategy == o.send_strategy &&
194
203
  template == o.template &&
195
- template_variables == o.template_variables
204
+ template_variables == o.template_variables &&
205
+ use_inbox_name == o.use_inbox_name
196
206
  end
197
207
 
198
208
  # @see the `==` method
@@ -204,7 +214,7 @@ module MailSlurpClient
204
214
  # Calculates hash code according to all attributes.
205
215
  # @return [Integer] Hash code
206
216
  def hash
207
- [attachments, body, charset, from, is_html, reply_to, send_strategy, template, template_variables].hash
217
+ [attachments, body, charset, from, is_html, reply_to, send_strategy, template, template_variables, use_inbox_name].hash
208
218
  end
209
219
 
210
220
  # Builds the object from hash
@@ -15,7 +15,7 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Options for sending an email message from an inbox. You must provide one of: `to`, `toGroup`, or `toContacts` to send an email. All other parameters are optional.
17
17
  class SendEmailOptions
18
- # Optional list of attachment IDs to send with this email. You must first upload each attachment separately in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded.
18
+ # Optional list of attachment IDs to send with this email. You must first upload each attachment separately via method call or dashboard in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded. There are several ways to upload that support `multi-part form`, `base64 file encoding`, and octet stream binary uploads. See the `UploadController` for available methods.
19
19
  attr_accessor :attachments
20
20
 
21
21
  # Optional list of bcc destination email addresses
@@ -30,9 +30,12 @@ module MailSlurpClient
30
30
  # Optional charset
31
31
  attr_accessor :charset
32
32
 
33
- # Optional from address. If not set the source inbox address will be used for this field. Beware of potential spam penalties when setting this field to an address not used by the inbox. For custom email addresses use a custom domain.
33
+ # Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets (`my@address.com` or `My inbox <my@address.com>`). If no sender is set the source inbox address will be used for this field. If you set `useInboxName` to `true` the from field will include the inbox name as a display name: `inbox_name <inbox@address.com>`. For this to work use the name field when creating an inbox. Beware of potential spam penalties when setting the from field to an address not used by the inbox. Your emails may get blocked by services if you impersonate another address. To use a custom email addresses use a custom domain. You can create domains with the DomainController. The domain must be verified in the dashboard before it can be used.
34
34
  attr_accessor :from
35
35
 
36
+ # Optional HTML flag to indicate that contents is HTML. Set's a `content-type: text/html` for email. (Deprecated: use `isHTML` instead.)
37
+ attr_accessor :html
38
+
36
39
  # Optional HTML flag. If true the `content-type` of the email will be `text/html`. Set to true when sending HTML to ensure proper rending on email clients
37
40
  attr_accessor :is_html
38
41
 
@@ -51,7 +54,7 @@ module MailSlurpClient
51
54
  # Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found.
52
55
  attr_accessor :template_variables
53
56
 
54
- # List of destination email addresses. Even single recipients must be in array form. Maximum recipients per email depends on your plan. If you need to send many emails try using contacts or contact groups or use a non standard sendStrategy to ensure that spam filters are not triggered (many recipients in one email can affect your spam rating).
57
+ # List of destination email addresses. Each email address must be RFC 5322 format. Even single recipients must be in array form. Maximum recipients per email depends on your plan. If you need to send many emails try using contacts or contact groups or use a non standard sendStrategy to ensure that spam filters are not triggered (many recipients in one email can affect your spam rating). Be cautious when sending emails that your recipients exist. High bounce rates (meaning a high percentage of emails cannot be delivered because an address does not exist) can result in account freezing.
55
58
  attr_accessor :to
56
59
 
57
60
  # Optional list of contact IDs to send email to. Manage your contacts via the API or dashboard. When contacts are used the email is sent to each contact separately so they will not see other recipients.
@@ -60,6 +63,9 @@ module MailSlurpClient
60
63
  # Optional contact group ID to send email to. You can create contacts and contact groups in the API or dashboard and use them for email campaigns. When contact groups are used the email is sent to each contact separately so they will not see other recipients
61
64
  attr_accessor :to_group
62
65
 
66
+ # Use name of inbox as sender email address name. Will construct RFC 5322 email address with `Inbox name <inbox@address.com>` if the inbox has a name.
67
+ attr_accessor :use_inbox_name
68
+
63
69
  class EnumAttributeValidator
64
70
  attr_reader :datatype
65
71
  attr_reader :allowable_values
@@ -91,6 +97,7 @@ module MailSlurpClient
91
97
  :'cc' => :'cc',
92
98
  :'charset' => :'charset',
93
99
  :'from' => :'from',
100
+ :'html' => :'html',
94
101
  :'is_html' => :'isHTML',
95
102
  :'reply_to' => :'replyTo',
96
103
  :'send_strategy' => :'sendStrategy',
@@ -99,7 +106,8 @@ module MailSlurpClient
99
106
  :'template_variables' => :'templateVariables',
100
107
  :'to' => :'to',
101
108
  :'to_contacts' => :'toContacts',
102
- :'to_group' => :'toGroup'
109
+ :'to_group' => :'toGroup',
110
+ :'use_inbox_name' => :'useInboxName'
103
111
  }
104
112
  end
105
113
 
@@ -112,6 +120,7 @@ module MailSlurpClient
112
120
  :'cc' => :'Array<String>',
113
121
  :'charset' => :'String',
114
122
  :'from' => :'String',
123
+ :'html' => :'Boolean',
115
124
  :'is_html' => :'Boolean',
116
125
  :'reply_to' => :'String',
117
126
  :'send_strategy' => :'String',
@@ -120,7 +129,8 @@ module MailSlurpClient
120
129
  :'template_variables' => :'Object',
121
130
  :'to' => :'Array<String>',
122
131
  :'to_contacts' => :'Array<String>',
123
- :'to_group' => :'String'
132
+ :'to_group' => :'String',
133
+ :'use_inbox_name' => :'Boolean'
124
134
  }
125
135
  end
126
136
 
@@ -175,6 +185,10 @@ module MailSlurpClient
175
185
  self.from = attributes[:'from']
176
186
  end
177
187
 
188
+ if attributes.key?(:'html')
189
+ self.html = attributes[:'html']
190
+ end
191
+
178
192
  if attributes.key?(:'is_html')
179
193
  self.is_html = attributes[:'is_html']
180
194
  end
@@ -214,6 +228,10 @@ module MailSlurpClient
214
228
  if attributes.key?(:'to_group')
215
229
  self.to_group = attributes[:'to_group']
216
230
  end
231
+
232
+ if attributes.key?(:'use_inbox_name')
233
+ self.use_inbox_name = attributes[:'use_inbox_name']
234
+ end
217
235
  end
218
236
 
219
237
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -252,6 +270,7 @@ module MailSlurpClient
252
270
  cc == o.cc &&
253
271
  charset == o.charset &&
254
272
  from == o.from &&
273
+ html == o.html &&
255
274
  is_html == o.is_html &&
256
275
  reply_to == o.reply_to &&
257
276
  send_strategy == o.send_strategy &&
@@ -260,7 +279,8 @@ module MailSlurpClient
260
279
  template_variables == o.template_variables &&
261
280
  to == o.to &&
262
281
  to_contacts == o.to_contacts &&
263
- to_group == o.to_group
282
+ to_group == o.to_group &&
283
+ use_inbox_name == o.use_inbox_name
264
284
  end
265
285
 
266
286
  # @see the `==` method
@@ -272,7 +292,7 @@ module MailSlurpClient
272
292
  # Calculates hash code according to all attributes.
273
293
  # @return [Integer] Hash code
274
294
  def hash
275
- [attachments, bcc, body, cc, charset, from, is_html, reply_to, send_strategy, subject, template, template_variables, to, to_contacts, to_group].hash
295
+ [attachments, bcc, body, cc, charset, from, html, is_html, reply_to, send_strategy, subject, template, template_variables, to, to_contacts, to_group, use_inbox_name].hash
276
296
  end
277
297
 
278
298
  # Builds the object from hash
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Conditions that a `waitForXEmails` endpoint operates on. The methods wait until given conditions are met or a timeout is reached. If the conditions are met without needing to wait the results will be returned immediately.
16
+ # Conditions that a `waitForXEmails` endpoint operates on. The methods wait until given conditions are met or a timeout is reached. If the conditions are met without needing to wait the results will be returned immediately. Can include `unreadOnly` to ignore already read emails that were returned in an API call or viewing in the dashboard. Can also include matches for emails containing `from`, `subject`, `hasAttachments` etc.
17
17
  class WaitForConditions
18
18
  # Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation.
19
19
  attr_accessor :count
@@ -0,0 +1,312 @@
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
+
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
+ # NEW_ATTACHMENT webhook payload
17
+ class WebhookNewAttachmentPayload
18
+ # ID of attachment. Use the `AttachmentController` to
19
+ attr_accessor :attachment_id
20
+
21
+ # Size of attachment in bytes
22
+ attr_accessor :content_length
23
+
24
+ # Content type of attachment such as 'image/png' or 'application/pdf
25
+ attr_accessor :content_type
26
+
27
+ # Name of the event type webhook is being triggered for.
28
+ attr_accessor :event_name
29
+
30
+ # Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
31
+ attr_accessor :message_id
32
+
33
+ # Filename of the attachment if present
34
+ attr_accessor :name
35
+
36
+ # ID of webhook entity being triggered
37
+ attr_accessor :webhook_id
38
+
39
+ # Name of the webhook being triggered
40
+ attr_accessor :webhook_name
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'attachment_id' => :'attachmentId',
68
+ :'content_length' => :'contentLength',
69
+ :'content_type' => :'contentType',
70
+ :'event_name' => :'eventName',
71
+ :'message_id' => :'messageId',
72
+ :'name' => :'name',
73
+ :'webhook_id' => :'webhookId',
74
+ :'webhook_name' => :'webhookName'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'attachment_id' => :'String',
82
+ :'content_length' => :'Integer',
83
+ :'content_type' => :'String',
84
+ :'event_name' => :'String',
85
+ :'message_id' => :'String',
86
+ :'name' => :'String',
87
+ :'webhook_id' => :'String',
88
+ :'webhook_name' => :'String'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ if (!attributes.is_a?(Hash))
102
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookNewAttachmentPayload` initialize method"
103
+ end
104
+
105
+ # check to see if the attribute exists and convert string to symbol for hash key
106
+ attributes = attributes.each_with_object({}) { |(k, v), h|
107
+ if (!self.class.attribute_map.key?(k.to_sym))
108
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookNewAttachmentPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
109
+ end
110
+ h[k.to_sym] = v
111
+ }
112
+
113
+ if attributes.key?(:'attachment_id')
114
+ self.attachment_id = attributes[:'attachment_id']
115
+ end
116
+
117
+ if attributes.key?(:'content_length')
118
+ self.content_length = attributes[:'content_length']
119
+ end
120
+
121
+ if attributes.key?(:'content_type')
122
+ self.content_type = attributes[:'content_type']
123
+ end
124
+
125
+ if attributes.key?(:'event_name')
126
+ self.event_name = attributes[:'event_name']
127
+ end
128
+
129
+ if attributes.key?(:'message_id')
130
+ self.message_id = attributes[:'message_id']
131
+ end
132
+
133
+ if attributes.key?(:'name')
134
+ self.name = attributes[:'name']
135
+ end
136
+
137
+ if attributes.key?(:'webhook_id')
138
+ self.webhook_id = attributes[:'webhook_id']
139
+ end
140
+
141
+ if attributes.key?(:'webhook_name')
142
+ self.webhook_name = attributes[:'webhook_name']
143
+ end
144
+ end
145
+
146
+ # Show invalid properties with the reasons. Usually used together with valid?
147
+ # @return Array for valid properties with the reasons
148
+ def list_invalid_properties
149
+ invalid_properties = Array.new
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
157
+ return false unless event_name_validator.valid?(@event_name)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] event_name Object to be assigned
163
+ def event_name=(event_name)
164
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
165
+ unless validator.valid?(event_name)
166
+ fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @event_name = event_name
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ attachment_id == o.attachment_id &&
177
+ content_length == o.content_length &&
178
+ content_type == o.content_type &&
179
+ event_name == o.event_name &&
180
+ message_id == o.message_id &&
181
+ name == o.name &&
182
+ webhook_id == o.webhook_id &&
183
+ webhook_name == o.webhook_name
184
+ end
185
+
186
+ # @see the `==` method
187
+ # @param [Object] Object to be compared
188
+ def eql?(o)
189
+ self == o
190
+ end
191
+
192
+ # Calculates hash code according to all attributes.
193
+ # @return [Integer] Hash code
194
+ def hash
195
+ [attachment_id, content_length, content_type, event_name, message_id, name, webhook_id, webhook_name].hash
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 self.build_from_hash(attributes)
202
+ new.build_from_hash(attributes)
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ self.class.openapi_types.each_pair do |key, type|
211
+ if type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :Boolean
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ MailSlurpClient.const_get(type).build_from_hash(value)
263
+ end
264
+ end
265
+
266
+ # Returns the string representation of the object
267
+ # @return [String] String presentation of the object
268
+ def to_s
269
+ to_hash.to_s
270
+ end
271
+
272
+ # to_body is an alias to to_hash (backward compatibility)
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_body
275
+ to_hash
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
289
+ hash[param] = _to_hash(value)
290
+ end
291
+ hash
292
+ end
293
+
294
+ # Outputs non-array value in the form of hash
295
+ # For object, use to_hash. Otherwise, just return the value
296
+ # @param [Object] value Any valid value
297
+ # @return [Hash] Returns the value in the form of hash
298
+ def _to_hash(value)
299
+ if value.is_a?(Array)
300
+ value.compact.map { |v| _to_hash(v) }
301
+ elsif value.is_a?(Hash)
302
+ {}.tap do |hash|
303
+ value.each { |k, v| hash[k] = _to_hash(v) }
304
+ end
305
+ elsif value.respond_to? :to_hash
306
+ value.to_hash
307
+ else
308
+ value
309
+ end
310
+ end
311
+ end
312
+ end