mailslurp_client 11.9.4 → 11.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/lib/mailslurp_client.rb +2 -0
- data/lib/mailslurp_client/api/attachment_controller_api.rb +129 -0
- data/lib/mailslurp_client/api/email_controller_api.rb +8 -8
- data/lib/mailslurp_client/models/attachment_entity.rb +289 -0
- data/lib/mailslurp_client/models/page_attachment_entity.rb +299 -0
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d595dcdec4ad737455d4ee826731f1535da97d365c511d2ab419b31d8025594
|
4
|
+
data.tar.gz: ebb0cb3aa796964615d098a98bcba05844f62531959fadc281f4dcf7842fd104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff8e4393e39c4d9b209d5e257e8ed1d2a5a5aa1c6026f45dc726bdd83f23180b03075b11eaaae2a60ee58d70783148beb8bad140afbb39e509c4594327a3b021
|
7
|
+
data.tar.gz: 4bbf0f4df5cbcd07a076cde240adf8d9b0a4e9070d7ef8cb2c51ed82e73a8529fd979ccfa7cd4b3d65c6875653b5227c97c854b22983be29fa277c9ea96c9fc2
|
data/README.md
CHANGED
@@ -10,6 +10,14 @@ MailSlurp is an email API service that lets you create real email addresses in c
|
|
10
10
|
- [Gem Package](https://rubygems.org/gems/mailslurp_client)
|
11
11
|
- [Github Source](https://github.com/mailslurp/mailslurp-client-ruby)
|
12
12
|
|
13
|
+
### Common controllers
|
14
|
+
- [Email controller](https://www.mailslurp.com/docs/ruby/docs/EmailControllerApi/) send and receive emails
|
15
|
+
- [Inbox controller](https://www.mailslurp.com/docs/ruby/docs/InboxControllerApi/) create and manage email addresses
|
16
|
+
- [WaitFor controller](https://www.mailslurp.com/docs/ruby/docs/WaitForControllerApi/) wait for expected emails to arrive
|
17
|
+
|
18
|
+
|
19
|
+
### Example tutorials
|
20
|
+
|
13
21
|
## Get started
|
14
22
|
|
15
23
|
This section describes how to get up and running with the Ruby client.
|
@@ -70,7 +78,7 @@ Here are some common uses:
|
|
70
78
|
|
71
79
|
### Create inboxes
|
72
80
|
|
73
|
-
To use MailSlurp you need to create inboxes. These are email accounts that have an ID and a real email address.
|
81
|
+
To use MailSlurp you need to create inboxes. These are email accounts that have an ID and a real email address. See methods on the [inbox controller](https://www.mailslurp.com/docs/ruby/docs/InboxControllerApi/) for more information.
|
74
82
|
|
75
83
|
```ruby
|
76
84
|
inbox_controller = MailSlurpClient::InboxControllerApi.new
|
@@ -120,7 +128,7 @@ end
|
|
120
128
|
|
121
129
|
### List inboxes
|
122
130
|
|
123
|
-
Inboxes you create can be listed in a paginated way.
|
131
|
+
Inboxes you create can be listed in a paginated way using the [InboxController](https://www.mailslurp.com/docs/ruby/docs/InboxControllerApi/)).
|
124
132
|
|
125
133
|
```ruby
|
126
134
|
it 'can list inboxes' do
|
@@ -181,7 +189,7 @@ opts = {
|
|
181
189
|
inbox_controller.send_email(inbox_1.id, opts)
|
182
190
|
```
|
183
191
|
### Receive emails
|
184
|
-
|
192
|
+
To read already existing emails use the [Email Controller](https://www.mailslurp.com/docs/ruby/docs/EmailControllerApi/). To wait for expected emails to arrive use the [WaitFor Controller](https://www.mailslurp.com/docs/ruby/docs/WaitForControllerApi/).
|
185
193
|
You can use MailSlurp to wait for at least 1 unread email in an inbox and return it.
|
186
194
|
If a timeout is exceeded it will throw an error instead:
|
187
195
|
|
@@ -214,7 +222,7 @@ code, * = match.captures
|
|
214
222
|
|
215
223
|
### Attachments
|
216
224
|
|
217
|
-
You can send attachments by first uploading files with the
|
225
|
+
You can send attachments by first uploading files with the [AttachmentControllerApi](https://www.mailslurp.com/docs/ruby/docs/AttachmentControllerApi/) then using the returned attachment IDs in the send email method.
|
218
226
|
|
219
227
|
MailSlurp endpoints use base64 string encoding for upload and download files. To encode or decode strings in Ruby make sure you use the **strict** variables that avoid added newlines.
|
220
228
|
|
data/lib/mailslurp_client.rb
CHANGED
@@ -19,6 +19,7 @@ require 'mailslurp_client/configuration'
|
|
19
19
|
# Models
|
20
20
|
require 'mailslurp_client/models/alias_dto'
|
21
21
|
require 'mailslurp_client/models/alias_projection'
|
22
|
+
require 'mailslurp_client/models/attachment_entity'
|
22
23
|
require 'mailslurp_client/models/attachment_meta_data'
|
23
24
|
require 'mailslurp_client/models/basic_auth_options'
|
24
25
|
require 'mailslurp_client/models/bulk_send_email_options'
|
@@ -67,6 +68,7 @@ require 'mailslurp_client/models/model_alias'
|
|
67
68
|
require 'mailslurp_client/models/name_server_record'
|
68
69
|
require 'mailslurp_client/models/organization_inbox_projection'
|
69
70
|
require 'mailslurp_client/models/page_alias'
|
71
|
+
require 'mailslurp_client/models/page_attachment_entity'
|
70
72
|
require 'mailslurp_client/models/page_contact_projection'
|
71
73
|
require 'mailslurp_client/models/page_email_preview'
|
72
74
|
require 'mailslurp_client/models/page_email_projection'
|
@@ -19,6 +19,66 @@ module MailSlurpClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Delete an attachment
|
23
|
+
# Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with `SendEmailOptions` when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.
|
24
|
+
# @param attachment_id [String] ID of attachment
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [nil]
|
27
|
+
def delete_attachment(attachment_id, opts = {})
|
28
|
+
delete_attachment_with_http_info(attachment_id, opts)
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# Delete an attachment
|
33
|
+
# Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with `SendEmailOptions` when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.
|
34
|
+
# @param attachment_id [String] ID of attachment
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
37
|
+
def delete_attachment_with_http_info(attachment_id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: AttachmentControllerApi.delete_attachment ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'attachment_id' is set
|
42
|
+
if @api_client.config.client_side_validation && attachment_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.delete_attachment"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
|
54
|
+
# form parameters
|
55
|
+
form_params = opts[:form_params] || {}
|
56
|
+
|
57
|
+
# http body (model)
|
58
|
+
post_body = opts[:body]
|
59
|
+
|
60
|
+
# return_type
|
61
|
+
return_type = opts[:return_type]
|
62
|
+
|
63
|
+
# auth_names
|
64
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
65
|
+
|
66
|
+
new_options = opts.merge(
|
67
|
+
:header_params => header_params,
|
68
|
+
:query_params => query_params,
|
69
|
+
:form_params => form_params,
|
70
|
+
:body => post_body,
|
71
|
+
:auth_names => auth_names,
|
72
|
+
:return_type => return_type
|
73
|
+
)
|
74
|
+
|
75
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
76
|
+
if @api_client.config.debugging
|
77
|
+
@api_client.config.logger.debug "API called: AttachmentControllerApi#delete_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
+
end
|
79
|
+
return data, status_code, headers
|
80
|
+
end
|
81
|
+
|
22
82
|
# Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
|
23
83
|
# Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses.
|
24
84
|
# @param attachment_id [String] ID of attachment
|
@@ -205,6 +265,75 @@ module MailSlurpClient
|
|
205
265
|
return data, status_code, headers
|
206
266
|
end
|
207
267
|
|
268
|
+
# Get email attachments
|
269
|
+
# Get all attachments in paginated response. Each entity contains meta data for the attachment such as `name` and `content-type`. Use the `attachmentId` and the download endpoints to get the file contents.
|
270
|
+
# @param [Hash] opts the optional parameters
|
271
|
+
# @option opts [Integer] :page Optional page index event list pagination (default to 0)
|
272
|
+
# @option opts [Integer] :size Optional page size event list pagination (default to 20)
|
273
|
+
# @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
|
274
|
+
# @return [PageAttachmentEntity]
|
275
|
+
def get_attachments(opts = {})
|
276
|
+
data, _status_code, _headers = get_attachments_with_http_info(opts)
|
277
|
+
data
|
278
|
+
end
|
279
|
+
|
280
|
+
# Get email attachments
|
281
|
+
# Get all attachments in paginated response. Each entity contains meta data for the attachment such as `name` and `content-type`. Use the `attachmentId` and the download endpoints to get the file contents.
|
282
|
+
# @param [Hash] opts the optional parameters
|
283
|
+
# @option opts [Integer] :page Optional page index event list pagination
|
284
|
+
# @option opts [Integer] :size Optional page size event list pagination
|
285
|
+
# @option opts [String] :sort Optional createdAt sort direction ASC or DESC
|
286
|
+
# @return [Array<(PageAttachmentEntity, Integer, Hash)>] PageAttachmentEntity data, response status code and response headers
|
287
|
+
def get_attachments_with_http_info(opts = {})
|
288
|
+
if @api_client.config.debugging
|
289
|
+
@api_client.config.logger.debug 'Calling API: AttachmentControllerApi.get_attachments ...'
|
290
|
+
end
|
291
|
+
allowable_values = ["ASC", "DESC"]
|
292
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
293
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
294
|
+
end
|
295
|
+
# resource path
|
296
|
+
local_var_path = '/attachments'
|
297
|
+
|
298
|
+
# query parameters
|
299
|
+
query_params = opts[:query_params] || {}
|
300
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
301
|
+
query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
|
302
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
303
|
+
|
304
|
+
# header parameters
|
305
|
+
header_params = opts[:header_params] || {}
|
306
|
+
# HTTP header 'Accept' (if needed)
|
307
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
308
|
+
|
309
|
+
# form parameters
|
310
|
+
form_params = opts[:form_params] || {}
|
311
|
+
|
312
|
+
# http body (model)
|
313
|
+
post_body = opts[:body]
|
314
|
+
|
315
|
+
# return_type
|
316
|
+
return_type = opts[:return_type] || 'PageAttachmentEntity'
|
317
|
+
|
318
|
+
# auth_names
|
319
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
320
|
+
|
321
|
+
new_options = opts.merge(
|
322
|
+
:header_params => header_params,
|
323
|
+
:query_params => query_params,
|
324
|
+
:form_params => form_params,
|
325
|
+
:body => post_body,
|
326
|
+
:auth_names => auth_names,
|
327
|
+
:return_type => return_type
|
328
|
+
)
|
329
|
+
|
330
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
331
|
+
if @api_client.config.debugging
|
332
|
+
@api_client.config.logger.debug "API called: AttachmentControllerApi#get_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
333
|
+
end
|
334
|
+
return data, status_code, headers
|
335
|
+
end
|
336
|
+
|
208
337
|
# Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
|
209
338
|
# Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with `SendEmailOptions` when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.
|
210
339
|
# @param upload_options [UploadAttachmentOptions] uploadOptions
|
@@ -413,8 +413,8 @@ module MailSlurpClient
|
|
413
413
|
# @param email_id [String] ID of email
|
414
414
|
# @param [Hash] opts the optional parameters
|
415
415
|
# @return [Array<AttachmentMetaData>]
|
416
|
-
def
|
417
|
-
data, _status_code, _headers =
|
416
|
+
def get_attachments1(email_id, opts = {})
|
417
|
+
data, _status_code, _headers = get_attachments1_with_http_info(email_id, opts)
|
418
418
|
data
|
419
419
|
end
|
420
420
|
|
@@ -423,13 +423,13 @@ module MailSlurpClient
|
|
423
423
|
# @param email_id [String] ID of email
|
424
424
|
# @param [Hash] opts the optional parameters
|
425
425
|
# @return [Array<(Array<AttachmentMetaData>, Integer, Hash)>] Array<AttachmentMetaData> data, response status code and response headers
|
426
|
-
def
|
426
|
+
def get_attachments1_with_http_info(email_id, opts = {})
|
427
427
|
if @api_client.config.debugging
|
428
|
-
@api_client.config.logger.debug 'Calling API: EmailControllerApi.
|
428
|
+
@api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachments1 ...'
|
429
429
|
end
|
430
430
|
# verify the required parameter 'email_id' is set
|
431
431
|
if @api_client.config.client_side_validation && email_id.nil?
|
432
|
-
fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.
|
432
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachments1"
|
433
433
|
end
|
434
434
|
# resource path
|
435
435
|
local_var_path = '/emails/{emailId}/attachments'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
|
@@ -465,12 +465,12 @@ module MailSlurpClient
|
|
465
465
|
|
466
466
|
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
467
467
|
if @api_client.config.debugging
|
468
|
-
@api_client.config.logger.debug "API called: EmailControllerApi#
|
468
|
+
@api_client.config.logger.debug "API called: EmailControllerApi#get_attachments1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
469
469
|
end
|
470
470
|
return data, status_code, headers
|
471
471
|
end
|
472
472
|
|
473
|
-
# Get email content
|
473
|
+
# Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
|
474
474
|
# Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints
|
475
475
|
# @param email_id [String] emailId
|
476
476
|
# @param [Hash] opts the optional parameters
|
@@ -481,7 +481,7 @@ module MailSlurpClient
|
|
481
481
|
data
|
482
482
|
end
|
483
483
|
|
484
|
-
# Get email content
|
484
|
+
# Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
|
485
485
|
# Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints
|
486
486
|
# @param email_id [String] emailId
|
487
487
|
# @param [Hash] opts the optional parameters
|
@@ -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
|
@@ -0,0 +1,299 @@
|
|
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
|
+
# Paginated attachment entity results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
|
17
|
+
class PageAttachmentEntity
|
18
|
+
attr_accessor :content
|
19
|
+
|
20
|
+
attr_accessor :empty
|
21
|
+
|
22
|
+
attr_accessor :first
|
23
|
+
|
24
|
+
attr_accessor :last
|
25
|
+
|
26
|
+
attr_accessor :number
|
27
|
+
|
28
|
+
attr_accessor :number_of_elements
|
29
|
+
|
30
|
+
attr_accessor :pageable
|
31
|
+
|
32
|
+
attr_accessor :size
|
33
|
+
|
34
|
+
attr_accessor :sort
|
35
|
+
|
36
|
+
attr_accessor :total_elements
|
37
|
+
|
38
|
+
attr_accessor :total_pages
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'content' => :'content',
|
44
|
+
:'empty' => :'empty',
|
45
|
+
:'first' => :'first',
|
46
|
+
:'last' => :'last',
|
47
|
+
:'number' => :'number',
|
48
|
+
:'number_of_elements' => :'numberOfElements',
|
49
|
+
:'pageable' => :'pageable',
|
50
|
+
:'size' => :'size',
|
51
|
+
:'sort' => :'sort',
|
52
|
+
:'total_elements' => :'totalElements',
|
53
|
+
:'total_pages' => :'totalPages'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.openapi_types
|
59
|
+
{
|
60
|
+
:'content' => :'Array<AttachmentEntity>',
|
61
|
+
:'empty' => :'Boolean',
|
62
|
+
:'first' => :'Boolean',
|
63
|
+
:'last' => :'Boolean',
|
64
|
+
:'number' => :'Integer',
|
65
|
+
:'number_of_elements' => :'Integer',
|
66
|
+
:'pageable' => :'Pageable',
|
67
|
+
:'size' => :'Integer',
|
68
|
+
:'sort' => :'Sort',
|
69
|
+
:'total_elements' => :'Integer',
|
70
|
+
:'total_pages' => :'Integer'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# List of attributes with nullable: true
|
75
|
+
def self.openapi_nullable
|
76
|
+
Set.new([
|
77
|
+
])
|
78
|
+
end
|
79
|
+
|
80
|
+
# Initializes the object
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
def initialize(attributes = {})
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::PageAttachmentEntity` initialize method"
|
85
|
+
end
|
86
|
+
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::PageAttachmentEntity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
94
|
+
|
95
|
+
if attributes.key?(:'content')
|
96
|
+
if (value = attributes[:'content']).is_a?(Array)
|
97
|
+
self.content = value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'empty')
|
102
|
+
self.empty = attributes[:'empty']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'first')
|
106
|
+
self.first = attributes[:'first']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'last')
|
110
|
+
self.last = attributes[:'last']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'number')
|
114
|
+
self.number = attributes[:'number']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'number_of_elements')
|
118
|
+
self.number_of_elements = attributes[:'number_of_elements']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'pageable')
|
122
|
+
self.pageable = attributes[:'pageable']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'size')
|
126
|
+
self.size = attributes[:'size']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'sort')
|
130
|
+
self.sort = attributes[:'sort']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'total_elements')
|
134
|
+
self.total_elements = attributes[:'total_elements']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'total_pages')
|
138
|
+
self.total_pages = attributes[:'total_pages']
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
143
|
+
# @return Array for valid properties with the reasons
|
144
|
+
def list_invalid_properties
|
145
|
+
invalid_properties = Array.new
|
146
|
+
invalid_properties
|
147
|
+
end
|
148
|
+
|
149
|
+
# Check to see if the all the properties in the model are valid
|
150
|
+
# @return true if the model is valid
|
151
|
+
def valid?
|
152
|
+
true
|
153
|
+
end
|
154
|
+
|
155
|
+
# Checks equality by comparing each attribute.
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def ==(o)
|
158
|
+
return true if self.equal?(o)
|
159
|
+
self.class == o.class &&
|
160
|
+
content == o.content &&
|
161
|
+
empty == o.empty &&
|
162
|
+
first == o.first &&
|
163
|
+
last == o.last &&
|
164
|
+
number == o.number &&
|
165
|
+
number_of_elements == o.number_of_elements &&
|
166
|
+
pageable == o.pageable &&
|
167
|
+
size == o.size &&
|
168
|
+
sort == o.sort &&
|
169
|
+
total_elements == o.total_elements &&
|
170
|
+
total_pages == o.total_pages
|
171
|
+
end
|
172
|
+
|
173
|
+
# @see the `==` method
|
174
|
+
# @param [Object] Object to be compared
|
175
|
+
def eql?(o)
|
176
|
+
self == o
|
177
|
+
end
|
178
|
+
|
179
|
+
# Calculates hash code according to all attributes.
|
180
|
+
# @return [Integer] Hash code
|
181
|
+
def hash
|
182
|
+
[content, empty, first, last, number, number_of_elements, pageable, size, sort, total_elements, total_pages].hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Builds the object from hash
|
186
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
187
|
+
# @return [Object] Returns the model itself
|
188
|
+
def self.build_from_hash(attributes)
|
189
|
+
new.build_from_hash(attributes)
|
190
|
+
end
|
191
|
+
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def build_from_hash(attributes)
|
196
|
+
return nil unless attributes.is_a?(Hash)
|
197
|
+
self.class.openapi_types.each_pair do |key, type|
|
198
|
+
if type =~ /\AArray<(.*)>/i
|
199
|
+
# check to ensure the input is an array given that the attribute
|
200
|
+
# is documented as an array but the input is not
|
201
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
202
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
203
|
+
end
|
204
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
205
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
206
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
207
|
+
end
|
208
|
+
|
209
|
+
self
|
210
|
+
end
|
211
|
+
|
212
|
+
# Deserializes the data based on type
|
213
|
+
# @param string type Data type
|
214
|
+
# @param string value Value to be deserialized
|
215
|
+
# @return [Object] Deserialized data
|
216
|
+
def _deserialize(type, value)
|
217
|
+
case type.to_sym
|
218
|
+
when :DateTime
|
219
|
+
DateTime.parse(value)
|
220
|
+
when :Date
|
221
|
+
Date.parse(value)
|
222
|
+
when :String
|
223
|
+
value.to_s
|
224
|
+
when :Integer
|
225
|
+
value.to_i
|
226
|
+
when :Float
|
227
|
+
value.to_f
|
228
|
+
when :Boolean
|
229
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
230
|
+
true
|
231
|
+
else
|
232
|
+
false
|
233
|
+
end
|
234
|
+
when :Object
|
235
|
+
# generic object (usually a Hash), return directly
|
236
|
+
value
|
237
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
238
|
+
inner_type = Regexp.last_match[:inner_type]
|
239
|
+
value.map { |v| _deserialize(inner_type, v) }
|
240
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
241
|
+
k_type = Regexp.last_match[:k_type]
|
242
|
+
v_type = Regexp.last_match[:v_type]
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each do |k, v|
|
245
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
else # model
|
249
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
# Returns the string representation of the object
|
254
|
+
# @return [String] String presentation of the object
|
255
|
+
def to_s
|
256
|
+
to_hash.to_s
|
257
|
+
end
|
258
|
+
|
259
|
+
# to_body is an alias to to_hash (backward compatibility)
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
261
|
+
def to_body
|
262
|
+
to_hash
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the object in the form of hash
|
266
|
+
# @return [Hash] Returns the object in the form of hash
|
267
|
+
def to_hash
|
268
|
+
hash = {}
|
269
|
+
self.class.attribute_map.each_pair do |attr, param|
|
270
|
+
value = self.send(attr)
|
271
|
+
if value.nil?
|
272
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
273
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
274
|
+
end
|
275
|
+
|
276
|
+
hash[param] = _to_hash(value)
|
277
|
+
end
|
278
|
+
hash
|
279
|
+
end
|
280
|
+
|
281
|
+
# Outputs non-array value in the form of hash
|
282
|
+
# For object, use to_hash. Otherwise, just return the value
|
283
|
+
# @param [Object] value Any valid value
|
284
|
+
# @return [Hash] Returns the value in the form of hash
|
285
|
+
def _to_hash(value)
|
286
|
+
if value.is_a?(Array)
|
287
|
+
value.compact.map { |v| _to_hash(v) }
|
288
|
+
elsif value.is_a?(Hash)
|
289
|
+
{}.tap do |hash|
|
290
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
291
|
+
end
|
292
|
+
elsif value.respond_to? :to_hash
|
293
|
+
value.to_hash
|
294
|
+
else
|
295
|
+
value
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailslurp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mailslurp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Create emails addresses in Ruby then send and receive real emails and
|
14
14
|
attachments. See https://www.mailslurp.com/docs/ruby/ for full Ruby documentation.
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/mailslurp_client/configuration.rb
|
46
46
|
- lib/mailslurp_client/models/alias_dto.rb
|
47
47
|
- lib/mailslurp_client/models/alias_projection.rb
|
48
|
+
- lib/mailslurp_client/models/attachment_entity.rb
|
48
49
|
- lib/mailslurp_client/models/attachment_meta_data.rb
|
49
50
|
- lib/mailslurp_client/models/basic_auth_options.rb
|
50
51
|
- lib/mailslurp_client/models/bulk_send_email_options.rb
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- lib/mailslurp_client/models/name_server_record.rb
|
94
95
|
- lib/mailslurp_client/models/organization_inbox_projection.rb
|
95
96
|
- lib/mailslurp_client/models/page_alias.rb
|
97
|
+
- lib/mailslurp_client/models/page_attachment_entity.rb
|
96
98
|
- lib/mailslurp_client/models/page_contact_projection.rb
|
97
99
|
- lib/mailslurp_client/models/page_email_preview.rb
|
98
100
|
- lib/mailslurp_client/models/page_email_projection.rb
|