mailslurp_client 12.8.2 → 13.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailslurp_client.rb +3 -0
- data/lib/mailslurp_client/api/attachment_controller_api.rb +117 -3
- data/lib/mailslurp_client/api/email_controller_api.rb +193 -2
- data/lib/mailslurp_client/api/inbox_controller_api.rb +6 -0
- data/lib/mailslurp_client/api/wait_for_controller_api.rb +67 -2
- data/lib/mailslurp_client/models/attachment_entity.rb +289 -0
- data/lib/mailslurp_client/models/email_links_result.rb +228 -0
- data/lib/mailslurp_client/models/gravatar_url.rb +225 -0
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +5 -2
@@ -83,7 +83,10 @@ module MailSlurpClient
|
|
83
83
|
# If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.
|
84
84
|
# @param [Hash] opts the optional parameters
|
85
85
|
# @option opts [Integer] :count Number of emails to wait for. Must be greater that 1
|
86
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
86
87
|
# @option opts [String] :inbox_id Id of the inbox we are fetching emails from
|
88
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
89
|
+
# @option opts [String] :sort Sort direction
|
87
90
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
88
91
|
# @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
|
89
92
|
# @return [Array<EmailPreview>]
|
@@ -96,7 +99,10 @@ module MailSlurpClient
|
|
96
99
|
# If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.
|
97
100
|
# @param [Hash] opts the optional parameters
|
98
101
|
# @option opts [Integer] :count Number of emails to wait for. Must be greater that 1
|
102
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
99
103
|
# @option opts [String] :inbox_id Id of the inbox we are fetching emails from
|
104
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
105
|
+
# @option opts [String] :sort Sort direction
|
100
106
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
101
107
|
# @option opts [Boolean] :unread_only Optional filter for unread only
|
102
108
|
# @return [Array<(Array<EmailPreview>, Integer, Hash)>] Array<EmailPreview> data, response status code and response headers
|
@@ -104,13 +110,20 @@ module MailSlurpClient
|
|
104
110
|
if @api_client.config.debugging
|
105
111
|
@api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_email_count ...'
|
106
112
|
end
|
113
|
+
allowable_values = ["ASC", "DESC"]
|
114
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
115
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
116
|
+
end
|
107
117
|
# resource path
|
108
118
|
local_var_path = '/waitForEmailCount'
|
109
119
|
|
110
120
|
# query parameters
|
111
121
|
query_params = opts[:query_params] || {}
|
112
122
|
query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
|
123
|
+
query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?
|
113
124
|
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
|
125
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
126
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
114
127
|
query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
|
115
128
|
query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
|
116
129
|
|
@@ -150,7 +163,10 @@ module MailSlurpClient
|
|
150
163
|
# Fetch inbox's latest email or if empty wait for an email to arrive
|
151
164
|
# Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set `unreadOnly=true` or see the other receive methods such as `waitForNthEmail` or `waitForEmailCount`.
|
152
165
|
# @param [Hash] opts the optional parameters
|
166
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
153
167
|
# @option opts [String] :inbox_id Id of the inbox we are fetching emails from
|
168
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
169
|
+
# @option opts [String] :sort Sort direction
|
154
170
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
155
171
|
# @option opts [Boolean] :unread_only Optional filter for unread only. (default to false)
|
156
172
|
# @return [Email]
|
@@ -162,7 +178,10 @@ module MailSlurpClient
|
|
162
178
|
# Fetch inbox's latest email or if empty wait for an email to arrive
|
163
179
|
# Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set `unreadOnly=true` or see the other receive methods such as `waitForNthEmail` or `waitForEmailCount`.
|
164
180
|
# @param [Hash] opts the optional parameters
|
181
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
165
182
|
# @option opts [String] :inbox_id Id of the inbox we are fetching emails from
|
183
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
184
|
+
# @option opts [String] :sort Sort direction
|
166
185
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
167
186
|
# @option opts [Boolean] :unread_only Optional filter for unread only.
|
168
187
|
# @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers
|
@@ -170,12 +189,19 @@ module MailSlurpClient
|
|
170
189
|
if @api_client.config.debugging
|
171
190
|
@api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_latest_email ...'
|
172
191
|
end
|
192
|
+
allowable_values = ["ASC", "DESC"]
|
193
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
194
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
195
|
+
end
|
173
196
|
# resource path
|
174
197
|
local_var_path = '/waitForLatestEmail'
|
175
198
|
|
176
199
|
# query parameters
|
177
200
|
query_params = opts[:query_params] || {}
|
201
|
+
query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?
|
178
202
|
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
|
203
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
204
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
179
205
|
query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
|
180
206
|
query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
|
181
207
|
|
@@ -216,8 +242,11 @@ module MailSlurpClient
|
|
216
242
|
# Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.
|
217
243
|
# @param match_options [MatchOptions] matchOptions
|
218
244
|
# @param [Hash] opts the optional parameters
|
219
|
-
# @option opts [Integer] :count Number of emails to wait for. Must be greater
|
245
|
+
# @option opts [Integer] :count Number of emails to wait for. Must be greater or equal to 1
|
246
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
220
247
|
# @option opts [String] :inbox_id Id of the inbox we are fetching emails from
|
248
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
249
|
+
# @option opts [String] :sort Sort direction
|
221
250
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
222
251
|
# @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
|
223
252
|
# @return [Array<EmailPreview>]
|
@@ -230,8 +259,11 @@ module MailSlurpClient
|
|
230
259
|
# Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.
|
231
260
|
# @param match_options [MatchOptions] matchOptions
|
232
261
|
# @param [Hash] opts the optional parameters
|
233
|
-
# @option opts [Integer] :count Number of emails to wait for. Must be greater
|
262
|
+
# @option opts [Integer] :count Number of emails to wait for. Must be greater or equal to 1
|
263
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
234
264
|
# @option opts [String] :inbox_id Id of the inbox we are fetching emails from
|
265
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
266
|
+
# @option opts [String] :sort Sort direction
|
235
267
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
236
268
|
# @option opts [Boolean] :unread_only Optional filter for unread only
|
237
269
|
# @return [Array<(Array<EmailPreview>, Integer, Hash)>] Array<EmailPreview> data, response status code and response headers
|
@@ -243,13 +275,20 @@ module MailSlurpClient
|
|
243
275
|
if @api_client.config.client_side_validation && match_options.nil?
|
244
276
|
fail ArgumentError, "Missing the required parameter 'match_options' when calling WaitForControllerApi.wait_for_matching_email"
|
245
277
|
end
|
278
|
+
allowable_values = ["ASC", "DESC"]
|
279
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
280
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
281
|
+
end
|
246
282
|
# resource path
|
247
283
|
local_var_path = '/waitForMatchingEmails'
|
248
284
|
|
249
285
|
# query parameters
|
250
286
|
query_params = opts[:query_params] || {}
|
251
287
|
query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
|
288
|
+
query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?
|
252
289
|
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
|
290
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
291
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
253
292
|
query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
|
254
293
|
query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
|
255
294
|
|
@@ -292,7 +331,10 @@ module MailSlurpClient
|
|
292
331
|
# Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.
|
293
332
|
# @param match_options [MatchOptions] matchOptions
|
294
333
|
# @param [Hash] opts the optional parameters
|
334
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
295
335
|
# @option opts [String] :inbox_id Id of the inbox we are matching an email for
|
336
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
337
|
+
# @option opts [String] :sort Sort direction
|
296
338
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
297
339
|
# @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
|
298
340
|
# @return [Email]
|
@@ -305,7 +347,10 @@ module MailSlurpClient
|
|
305
347
|
# Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.
|
306
348
|
# @param match_options [MatchOptions] matchOptions
|
307
349
|
# @param [Hash] opts the optional parameters
|
350
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
308
351
|
# @option opts [String] :inbox_id Id of the inbox we are matching an email for
|
352
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
353
|
+
# @option opts [String] :sort Sort direction
|
309
354
|
# @option opts [Integer] :timeout Max milliseconds to wait
|
310
355
|
# @option opts [Boolean] :unread_only Optional filter for unread only
|
311
356
|
# @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers
|
@@ -317,12 +362,19 @@ module MailSlurpClient
|
|
317
362
|
if @api_client.config.client_side_validation && match_options.nil?
|
318
363
|
fail ArgumentError, "Missing the required parameter 'match_options' when calling WaitForControllerApi.wait_for_matching_first_email"
|
319
364
|
end
|
365
|
+
allowable_values = ["ASC", "DESC"]
|
366
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
367
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
368
|
+
end
|
320
369
|
# resource path
|
321
370
|
local_var_path = '/waitForMatchingFirstEmail'
|
322
371
|
|
323
372
|
# query parameters
|
324
373
|
query_params = opts[:query_params] || {}
|
374
|
+
query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?
|
325
375
|
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
|
376
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
377
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
326
378
|
query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
|
327
379
|
query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
|
328
380
|
|
@@ -364,8 +416,11 @@ module MailSlurpClient
|
|
364
416
|
# Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.
|
365
417
|
# If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.
|
366
418
|
# @param [Hash] opts the optional parameters
|
419
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
367
420
|
# @option opts [String] :inbox_id Id of the inbox you are fetching emails from
|
368
421
|
# @option opts [Integer] :index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (default to 0)
|
422
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
423
|
+
# @option opts [String] :sort Sort direction
|
369
424
|
# @option opts [Integer] :timeout Max milliseconds to wait for the nth email if not already present
|
370
425
|
# @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
|
371
426
|
# @return [Email]
|
@@ -377,8 +432,11 @@ module MailSlurpClient
|
|
377
432
|
# Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.
|
378
433
|
# If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.
|
379
434
|
# @param [Hash] opts the optional parameters
|
435
|
+
# @option opts [Integer] :delay Max milliseconds delay between calls
|
380
436
|
# @option opts [String] :inbox_id Id of the inbox you are fetching emails from
|
381
437
|
# @option opts [Integer] :index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1
|
438
|
+
# @option opts [DateTime] :since Filter for emails that were received after the given timestamp
|
439
|
+
# @option opts [String] :sort Sort direction
|
382
440
|
# @option opts [Integer] :timeout Max milliseconds to wait for the nth email if not already present
|
383
441
|
# @option opts [Boolean] :unread_only Optional filter for unread only
|
384
442
|
# @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers
|
@@ -386,13 +444,20 @@ module MailSlurpClient
|
|
386
444
|
if @api_client.config.debugging
|
387
445
|
@api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_nth_email ...'
|
388
446
|
end
|
447
|
+
allowable_values = ["ASC", "DESC"]
|
448
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
449
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
450
|
+
end
|
389
451
|
# resource path
|
390
452
|
local_var_path = '/waitForNthEmail'
|
391
453
|
|
392
454
|
# query parameters
|
393
455
|
query_params = opts[:query_params] || {}
|
456
|
+
query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?
|
394
457
|
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
|
395
458
|
query_params[:'index'] = opts[:'index'] if !opts[:'index'].nil?
|
459
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
460
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
396
461
|
query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
|
397
462
|
query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
|
398
463
|
|
@@ -0,0 +1,289 @@
|
|
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
|
+
class AttachmentEntity
|
17
|
+
attr_accessor :attachment_id
|
18
|
+
|
19
|
+
attr_accessor :content_length
|
20
|
+
|
21
|
+
attr_accessor :content_type
|
22
|
+
|
23
|
+
attr_accessor :created_at
|
24
|
+
|
25
|
+
attr_accessor :id
|
26
|
+
|
27
|
+
attr_accessor :name
|
28
|
+
|
29
|
+
attr_accessor :updated_at
|
30
|
+
|
31
|
+
attr_accessor :user_id
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:'attachment_id' => :'attachmentId',
|
37
|
+
:'content_length' => :'contentLength',
|
38
|
+
:'content_type' => :'contentType',
|
39
|
+
:'created_at' => :'createdAt',
|
40
|
+
:'id' => :'id',
|
41
|
+
:'name' => :'name',
|
42
|
+
:'updated_at' => :'updatedAt',
|
43
|
+
:'user_id' => :'userId'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.openapi_types
|
49
|
+
{
|
50
|
+
:'attachment_id' => :'String',
|
51
|
+
:'content_length' => :'Integer',
|
52
|
+
:'content_type' => :'String',
|
53
|
+
:'created_at' => :'DateTime',
|
54
|
+
:'id' => :'String',
|
55
|
+
:'name' => :'String',
|
56
|
+
:'updated_at' => :'DateTime',
|
57
|
+
:'user_id' => :'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::AttachmentEntity` 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::AttachmentEntity`. 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?(:'attachment_id')
|
83
|
+
self.attachment_id = attributes[:'attachment_id']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'content_length')
|
87
|
+
self.content_length = attributes[:'content_length']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'content_type')
|
91
|
+
self.content_type = attributes[:'content_type']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'created_at')
|
95
|
+
self.created_at = attributes[:'created_at']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'id')
|
99
|
+
self.id = attributes[:'id']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'name')
|
103
|
+
self.name = attributes[:'name']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'updated_at')
|
107
|
+
self.updated_at = attributes[:'updated_at']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'user_id')
|
111
|
+
self.user_id = attributes[:'user_id']
|
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 @attachment_id.nil?
|
120
|
+
invalid_properties.push('invalid value for "attachment_id", attachment_id cannot be nil.')
|
121
|
+
end
|
122
|
+
|
123
|
+
if @created_at.nil?
|
124
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
125
|
+
end
|
126
|
+
|
127
|
+
if @updated_at.nil?
|
128
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
129
|
+
end
|
130
|
+
|
131
|
+
if @user_id.nil?
|
132
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
133
|
+
end
|
134
|
+
|
135
|
+
invalid_properties
|
136
|
+
end
|
137
|
+
|
138
|
+
# Check to see if the all the properties in the model are valid
|
139
|
+
# @return true if the model is valid
|
140
|
+
def valid?
|
141
|
+
return false if @attachment_id.nil?
|
142
|
+
return false if @created_at.nil?
|
143
|
+
return false if @updated_at.nil?
|
144
|
+
return false if @user_id.nil?
|
145
|
+
true
|
146
|
+
end
|
147
|
+
|
148
|
+
# Checks equality by comparing each attribute.
|
149
|
+
# @param [Object] Object to be compared
|
150
|
+
def ==(o)
|
151
|
+
return true if self.equal?(o)
|
152
|
+
self.class == o.class &&
|
153
|
+
attachment_id == o.attachment_id &&
|
154
|
+
content_length == o.content_length &&
|
155
|
+
content_type == o.content_type &&
|
156
|
+
created_at == o.created_at &&
|
157
|
+
id == o.id &&
|
158
|
+
name == o.name &&
|
159
|
+
updated_at == o.updated_at &&
|
160
|
+
user_id == o.user_id
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Integer] Hash code
|
171
|
+
def hash
|
172
|
+
[attachment_id, content_length, content_type, created_at, id, name, updated_at, user_id].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def self.build_from_hash(attributes)
|
179
|
+
new.build_from_hash(attributes)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Builds the object from hash
|
183
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
184
|
+
# @return [Object] Returns the model itself
|
185
|
+
def build_from_hash(attributes)
|
186
|
+
return nil unless attributes.is_a?(Hash)
|
187
|
+
self.class.openapi_types.each_pair do |key, type|
|
188
|
+
if type =~ /\AArray<(.*)>/i
|
189
|
+
# check to ensure the input is an array given that the attribute
|
190
|
+
# is documented as an array but the input is not
|
191
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
192
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
193
|
+
end
|
194
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
195
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
196
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
197
|
+
end
|
198
|
+
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Deserializes the data based on type
|
203
|
+
# @param string type Data type
|
204
|
+
# @param string value Value to be deserialized
|
205
|
+
# @return [Object] Deserialized data
|
206
|
+
def _deserialize(type, value)
|
207
|
+
case type.to_sym
|
208
|
+
when :DateTime
|
209
|
+
DateTime.parse(value)
|
210
|
+
when :Date
|
211
|
+
Date.parse(value)
|
212
|
+
when :String
|
213
|
+
value.to_s
|
214
|
+
when :Integer
|
215
|
+
value.to_i
|
216
|
+
when :Float
|
217
|
+
value.to_f
|
218
|
+
when :Boolean
|
219
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
220
|
+
true
|
221
|
+
else
|
222
|
+
false
|
223
|
+
end
|
224
|
+
when :Object
|
225
|
+
# generic object (usually a Hash), return directly
|
226
|
+
value
|
227
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
228
|
+
inner_type = Regexp.last_match[:inner_type]
|
229
|
+
value.map { |v| _deserialize(inner_type, v) }
|
230
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
231
|
+
k_type = Regexp.last_match[:k_type]
|
232
|
+
v_type = Regexp.last_match[:v_type]
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each do |k, v|
|
235
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
else # model
|
239
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns the string representation of the object
|
244
|
+
# @return [String] String presentation of the object
|
245
|
+
def to_s
|
246
|
+
to_hash.to_s
|
247
|
+
end
|
248
|
+
|
249
|
+
# to_body is an alias to to_hash (backward compatibility)
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
251
|
+
def to_body
|
252
|
+
to_hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns the object in the form of hash
|
256
|
+
# @return [Hash] Returns the object in the form of hash
|
257
|
+
def to_hash
|
258
|
+
hash = {}
|
259
|
+
self.class.attribute_map.each_pair do |attr, param|
|
260
|
+
value = self.send(attr)
|
261
|
+
if value.nil?
|
262
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
263
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
264
|
+
end
|
265
|
+
|
266
|
+
hash[param] = _to_hash(value)
|
267
|
+
end
|
268
|
+
hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Outputs non-array value in the form of hash
|
272
|
+
# For object, use to_hash. Otherwise, just return the value
|
273
|
+
# @param [Object] value Any valid value
|
274
|
+
# @return [Hash] Returns the value in the form of hash
|
275
|
+
def _to_hash(value)
|
276
|
+
if value.is_a?(Array)
|
277
|
+
value.compact.map { |v| _to_hash(v) }
|
278
|
+
elsif value.is_a?(Hash)
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
281
|
+
end
|
282
|
+
elsif value.respond_to? :to_hash
|
283
|
+
value.to_hash
|
284
|
+
else
|
285
|
+
value
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|