mailslurp_client 15.4.2 → 15.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/lib/mailslurp_client/api/email_controller_api.rb +70 -0
- data/lib/mailslurp_client/models/alias_projection.rb +13 -13
- data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
- data/lib/mailslurp_client/models/create_inbox_dto.rb +1 -1
- data/lib/mailslurp_client/models/email_projection.rb +12 -12
- data/lib/mailslurp_client/models/imap_flag_operation_options.rb +261 -0
- data/lib/mailslurp_client/models/page_alias.rb +19 -19
- data/lib/mailslurp_client/models/page_attachment_entity.rb +19 -19
- data/lib/mailslurp_client/models/page_bounced_email.rb +19 -19
- data/lib/mailslurp_client/models/page_bounced_recipients.rb +19 -19
- data/lib/mailslurp_client/models/page_contact_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_email_preview.rb +19 -19
- data/lib/mailslurp_client/models/page_email_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_group_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +19 -19
- data/lib/mailslurp_client/models/page_inbox_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +19 -19
- data/lib/mailslurp_client/models/page_missed_email_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_template_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_thread_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_webhook_projection.rb +19 -19
- data/lib/mailslurp_client/models/page_webhook_result.rb +19 -19
- data/lib/mailslurp_client/models/sent_email_projection.rb +17 -17
- data/lib/mailslurp_client/models/template_projection.rb +15 -15
- data/lib/mailslurp_client/version.rb +1 -1
- data/lib/mailslurp_client.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b75b33c50a3629ab32dd28e556042d913c728cf8036e62cc4851ee8f247593a
|
4
|
+
data.tar.gz: 119ad25eed3c17142d5ac5b2f60e381afc05691b7a479ce85c336c63bf0d2c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b738f483792378ab93be80e38e805f91ffe09e2d1220739a161e57090bea7a802f4fb43b386d0135d604fc871d4e13802cde4300548f832f3a1863643d771748
|
7
|
+
data.tar.gz: cbefd2e5946f24b12583ed3875b74b38ee54b60ac5829b5ea422ad96d8a62369268db7d09dc3e40636f39a487af5f30109e9274e6431f25b32e609c1cbfec016
|
data/README.md
CHANGED
@@ -9,6 +9,8 @@ MailSlurp is an email API service that lets you create real email addresses in c
|
|
9
9
|
- [Method Documentation](https://www.mailslurp.com/docs/ruby/docs/)
|
10
10
|
- [Gem Package](https://rubygems.org/gems/mailslurp_client)
|
11
11
|
- [Github Source](https://github.com/mailslurp/mailslurp-client-ruby)
|
12
|
+
- [SMTP access details](https://www.mailslurp.com/guides/smtp-imap/)
|
13
|
+
- [Send email in Ruby with SMTP](https://www.mailslurp.com/smtp/ruby-send-email-smtp/)
|
12
14
|
|
13
15
|
### Common controllers
|
14
16
|
|
@@ -133,6 +135,46 @@ end
|
|
133
135
|
|
134
136
|
Inboxes can be either `SMTP` or `HTTP` type. Set the inbox type using the `inboxType` property. SMTP inboxes are handled by a custom mailserver and support a wide range of clients while HTTP inboxes use Amazon SES and don't support some older clients like Outlook. SMTP inboxes are recommended for public facing email addresses while HTTP inboxes are best for application testing. Please see the guide on [types of inboxes](https://www.mailslurp.com/guides/smtp-vs-http-email-inboxes/) for more information.
|
135
137
|
|
138
|
+
|
139
|
+
### Configure NET/SMTP access
|
140
|
+
SMTP type inboxes allow SMTP and IMAP access using unique host, port, password, and username. Use the `inbox_controller.get_imap_smtp_access` method to access SMTP credentials. Then configure `net/smtp` in Ruby to send email using SMTP.
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
it 'can send email using SMTP' do
|
144
|
+
inbox_controller = MailSlurpClient::InboxControllerApi.new
|
145
|
+
|
146
|
+
# create two inboxes
|
147
|
+
inbox1 = inbox_controller.create_inbox_with_options({ inboxType: 'SMTP_INBOX' })
|
148
|
+
inbox2 = inbox_controller.create_inbox
|
149
|
+
|
150
|
+
expect(inbox1.email_address).to include('@mailslurp.mx')
|
151
|
+
|
152
|
+
# get smtp access for inbox
|
153
|
+
smtp_access = inbox_controller.get_imap_smtp_access({ inbox_id: inbox1.id })
|
154
|
+
|
155
|
+
# compose email
|
156
|
+
message = <<~MESSAGE_END
|
157
|
+
From: #{inbox1.email_address}
|
158
|
+
To: #{inbox2.email_address}
|
159
|
+
Subject: Test smtp email
|
160
|
+
|
161
|
+
This is a test
|
162
|
+
MESSAGE_END
|
163
|
+
|
164
|
+
# configure SMTP with host port and "PLAIN" authentication
|
165
|
+
Net::SMTP.start(smtp_access.smtp_server_host, smtp_access.smtp_server_port, 'greeting.your.domain',
|
166
|
+
smtp_access.smtp_username, smtp_access.smtp_password, :plain) do |smtp|
|
167
|
+
# send email
|
168
|
+
smtp.send_message message, inbox1.email_address, inbox2.email_address
|
169
|
+
end
|
170
|
+
|
171
|
+
# now confirm email was sent
|
172
|
+
wait_for_controller = MailSlurpClient::WaitForControllerApi.new
|
173
|
+
email = wait_for_controller.wait_for_latest_email({ inbox_id: inbox2.id })
|
174
|
+
expect(email.subject).to include("Test smtp email")
|
175
|
+
end
|
176
|
+
```
|
177
|
+
|
136
178
|
### List inboxes
|
137
179
|
|
138
180
|
Inboxes you create can be listed in a paginated way using the [InboxController](https://www.mailslurp.com/docs/ruby/docs/InboxControllerApi/)).
|
@@ -19,6 +19,76 @@ module MailSlurpClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Set IMAP flags associated with a message. Only supports '\\Seen' flag.
|
23
|
+
# Apply RFC3501 section-2.3.2 IMAP flag operations on an email
|
24
|
+
# @param email_id [String]
|
25
|
+
# @param imap_flag_operation_options [ImapFlagOperationOptions]
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [EmailPreview]
|
28
|
+
def apply_imap_flag_operation(email_id, imap_flag_operation_options, opts = {})
|
29
|
+
data, _status_code, _headers = apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Set IMAP flags associated with a message. Only supports '\\Seen' flag.
|
34
|
+
# Apply RFC3501 section-2.3.2 IMAP flag operations on an email
|
35
|
+
# @param email_id [String]
|
36
|
+
# @param imap_flag_operation_options [ImapFlagOperationOptions]
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<(EmailPreview, Integer, Hash)>] EmailPreview data, response status code and response headers
|
39
|
+
def apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: EmailControllerApi.apply_imap_flag_operation ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'email_id' is set
|
44
|
+
if @api_client.config.client_side_validation && email_id.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.apply_imap_flag_operation"
|
46
|
+
end
|
47
|
+
# verify the required parameter 'imap_flag_operation_options' is set
|
48
|
+
if @api_client.config.client_side_validation && imap_flag_operation_options.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'imap_flag_operation_options' when calling EmailControllerApi.apply_imap_flag_operation"
|
50
|
+
end
|
51
|
+
# resource path
|
52
|
+
local_var_path = '/emails/{emailId}/imap-flag-operation'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
|
53
|
+
|
54
|
+
# query parameters
|
55
|
+
query_params = opts[:query_params] || {}
|
56
|
+
|
57
|
+
# header parameters
|
58
|
+
header_params = opts[:header_params] || {}
|
59
|
+
# HTTP header 'Accept' (if needed)
|
60
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
61
|
+
# HTTP header 'Content-Type'
|
62
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
63
|
+
|
64
|
+
# form parameters
|
65
|
+
form_params = opts[:form_params] || {}
|
66
|
+
|
67
|
+
# http body (model)
|
68
|
+
post_body = opts[:body] || @api_client.object_to_http_body(imap_flag_operation_options)
|
69
|
+
|
70
|
+
# return_type
|
71
|
+
return_type = opts[:return_type] || 'EmailPreview'
|
72
|
+
|
73
|
+
# auth_names
|
74
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
75
|
+
|
76
|
+
new_options = opts.merge(
|
77
|
+
:header_params => header_params,
|
78
|
+
:query_params => query_params,
|
79
|
+
:form_params => form_params,
|
80
|
+
:body => post_body,
|
81
|
+
:auth_names => auth_names,
|
82
|
+
:return_type => return_type
|
83
|
+
)
|
84
|
+
|
85
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
86
|
+
if @api_client.config.debugging
|
87
|
+
@api_client.config.logger.debug "API called: EmailControllerApi#apply_imap_flag_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
88
|
+
end
|
89
|
+
return data, status_code, headers
|
90
|
+
end
|
91
|
+
|
22
92
|
# Delete all emails in all inboxes.
|
23
93
|
# Deletes all emails in your account. Be careful as emails cannot be recovered
|
24
94
|
# @param [Hash] opts the optional parameters
|
@@ -27,10 +27,10 @@ module MailSlurpClient
|
|
27
27
|
|
28
28
|
attr_accessor :created_at
|
29
29
|
|
30
|
-
attr_accessor :use_threads
|
31
|
-
|
32
30
|
attr_accessor :updated_at
|
33
31
|
|
32
|
+
attr_accessor :use_threads
|
33
|
+
|
34
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
35
35
|
def self.attribute_map
|
36
36
|
{
|
@@ -40,8 +40,8 @@ module MailSlurpClient
|
|
40
40
|
:'email_address' => :'emailAddress',
|
41
41
|
:'inbox_id' => :'inboxId',
|
42
42
|
:'created_at' => :'createdAt',
|
43
|
-
:'
|
44
|
-
:'
|
43
|
+
:'updated_at' => :'updatedAt',
|
44
|
+
:'use_threads' => :'useThreads'
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
@@ -54,8 +54,8 @@ module MailSlurpClient
|
|
54
54
|
:'email_address' => :'String',
|
55
55
|
:'inbox_id' => :'String',
|
56
56
|
:'created_at' => :'DateTime',
|
57
|
-
:'
|
58
|
-
:'
|
57
|
+
:'updated_at' => :'DateTime',
|
58
|
+
:'use_threads' => :'Boolean'
|
59
59
|
}
|
60
60
|
end
|
61
61
|
|
@@ -104,13 +104,13 @@ module MailSlurpClient
|
|
104
104
|
self.created_at = attributes[:'created_at']
|
105
105
|
end
|
106
106
|
|
107
|
-
if attributes.key?(:'use_threads')
|
108
|
-
self.use_threads = attributes[:'use_threads']
|
109
|
-
end
|
110
|
-
|
111
107
|
if attributes.key?(:'updated_at')
|
112
108
|
self.updated_at = attributes[:'updated_at']
|
113
109
|
end
|
110
|
+
|
111
|
+
if attributes.key?(:'use_threads')
|
112
|
+
self.use_threads = attributes[:'use_threads']
|
113
|
+
end
|
114
114
|
end
|
115
115
|
|
116
116
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -167,8 +167,8 @@ module MailSlurpClient
|
|
167
167
|
email_address == o.email_address &&
|
168
168
|
inbox_id == o.inbox_id &&
|
169
169
|
created_at == o.created_at &&
|
170
|
-
|
171
|
-
|
170
|
+
updated_at == o.updated_at &&
|
171
|
+
use_threads == o.use_threads
|
172
172
|
end
|
173
173
|
|
174
174
|
# @see the `==` method
|
@@ -180,7 +180,7 @@ module MailSlurpClient
|
|
180
180
|
# Calculates hash code according to all attributes.
|
181
181
|
# @return [Integer] Hash code
|
182
182
|
def hash
|
183
|
-
[name, id, user_id, email_address, inbox_id, created_at,
|
183
|
+
[name, id, user_id, email_address, inbox_id, created_at, updated_at, use_threads].hash
|
184
184
|
end
|
185
185
|
|
186
186
|
# Builds the object from hash
|
@@ -19,6 +19,9 @@ module MailSlurpClient
|
|
19
19
|
# Content length of attachment in bytes
|
20
20
|
attr_accessor :content_length
|
21
21
|
|
22
|
+
# Content type of attachment.
|
23
|
+
attr_accessor :content_type
|
24
|
+
|
22
25
|
attr_accessor :user_id
|
23
26
|
|
24
27
|
# Attachment ID
|
@@ -28,19 +31,16 @@ module MailSlurpClient
|
|
28
31
|
|
29
32
|
attr_accessor :updated_at
|
30
33
|
|
31
|
-
# Content type of attachment.
|
32
|
-
attr_accessor :content_type
|
33
|
-
|
34
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
35
35
|
def self.attribute_map
|
36
36
|
{
|
37
37
|
:'name' => :'name',
|
38
38
|
:'content_length' => :'contentLength',
|
39
|
+
:'content_type' => :'contentType',
|
39
40
|
:'user_id' => :'userId',
|
40
41
|
:'attachment_id' => :'attachmentId',
|
41
42
|
:'created_at' => :'createdAt',
|
42
|
-
:'updated_at' => :'updatedAt'
|
43
|
-
:'content_type' => :'contentType'
|
43
|
+
:'updated_at' => :'updatedAt'
|
44
44
|
}
|
45
45
|
end
|
46
46
|
|
@@ -49,11 +49,11 @@ module MailSlurpClient
|
|
49
49
|
{
|
50
50
|
:'name' => :'String',
|
51
51
|
:'content_length' => :'Integer',
|
52
|
+
:'content_type' => :'String',
|
52
53
|
:'user_id' => :'String',
|
53
54
|
:'attachment_id' => :'String',
|
54
55
|
:'created_at' => :'DateTime',
|
55
|
-
:'updated_at' => :'DateTime'
|
56
|
-
:'content_type' => :'String'
|
56
|
+
:'updated_at' => :'DateTime'
|
57
57
|
}
|
58
58
|
end
|
59
59
|
|
@@ -86,6 +86,10 @@ module MailSlurpClient
|
|
86
86
|
self.content_length = attributes[:'content_length']
|
87
87
|
end
|
88
88
|
|
89
|
+
if attributes.key?(:'content_type')
|
90
|
+
self.content_type = attributes[:'content_type']
|
91
|
+
end
|
92
|
+
|
89
93
|
if attributes.key?(:'user_id')
|
90
94
|
self.user_id = attributes[:'user_id']
|
91
95
|
end
|
@@ -101,10 +105,6 @@ module MailSlurpClient
|
|
101
105
|
if attributes.key?(:'updated_at')
|
102
106
|
self.updated_at = attributes[:'updated_at']
|
103
107
|
end
|
104
|
-
|
105
|
-
if attributes.key?(:'content_type')
|
106
|
-
self.content_type = attributes[:'content_type']
|
107
|
-
end
|
108
108
|
end
|
109
109
|
|
110
110
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -147,11 +147,11 @@ module MailSlurpClient
|
|
147
147
|
self.class == o.class &&
|
148
148
|
name == o.name &&
|
149
149
|
content_length == o.content_length &&
|
150
|
+
content_type == o.content_type &&
|
150
151
|
user_id == o.user_id &&
|
151
152
|
attachment_id == o.attachment_id &&
|
152
153
|
created_at == o.created_at &&
|
153
|
-
updated_at == o.updated_at
|
154
|
-
content_type == o.content_type
|
154
|
+
updated_at == o.updated_at
|
155
155
|
end
|
156
156
|
|
157
157
|
# @see the `==` method
|
@@ -163,7 +163,7 @@ module MailSlurpClient
|
|
163
163
|
# Calculates hash code according to all attributes.
|
164
164
|
# @return [Integer] Hash code
|
165
165
|
def hash
|
166
|
-
[name, content_length, user_id, attachment_id, created_at, updated_at
|
166
|
+
[name, content_length, content_type, user_id, attachment_id, created_at, updated_at].hash
|
167
167
|
end
|
168
168
|
|
169
169
|
# 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
|
-
# Options for creating an inbox. An inbox has a real email address that can send and receive emails. Inboxes can be permanent or expire at a given time. Inboxes are either `SMTP` or `HTTP` mailboxes. `SMTP` inboxes are
|
16
|
+
# Options for creating an inbox. An inbox has a real email address that can send and receive emails. Inboxes can be permanent or expire at a given time. Inboxes are either `SMTP` or `HTTP` mailboxes. `SMTP` inboxes are processed by a mail server running at `mx.mailslurp.com` while `HTTP` inboxes are processed by AWS SES. Inboxes can use a custom email address (by verifying your own domain) or a randomly assigned email ending in either `mailslurp.com` or (if `useDomainPool` is enabled) ending in a similar domain such as `mailslurp.xyz` (selected at random).
|
17
17
|
class CreateInboxDto
|
18
18
|
# A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.
|
19
19
|
attr_accessor :email_address
|
@@ -23,10 +23,10 @@ module MailSlurpClient
|
|
23
23
|
|
24
24
|
attr_accessor :inbox_id
|
25
25
|
|
26
|
-
attr_accessor :attachments
|
27
|
-
|
28
26
|
attr_accessor :to
|
29
27
|
|
28
|
+
attr_accessor :attachments
|
29
|
+
|
30
30
|
attr_accessor :bcc
|
31
31
|
|
32
32
|
attr_accessor :cc
|
@@ -48,8 +48,8 @@ module MailSlurpClient
|
|
48
48
|
:'from' => :'from',
|
49
49
|
:'subject' => :'subject',
|
50
50
|
:'inbox_id' => :'inboxId',
|
51
|
-
:'attachments' => :'attachments',
|
52
51
|
:'to' => :'to',
|
52
|
+
:'attachments' => :'attachments',
|
53
53
|
:'bcc' => :'bcc',
|
54
54
|
:'cc' => :'cc',
|
55
55
|
:'created_at' => :'createdAt',
|
@@ -67,8 +67,8 @@ module MailSlurpClient
|
|
67
67
|
:'from' => :'String',
|
68
68
|
:'subject' => :'String',
|
69
69
|
:'inbox_id' => :'String',
|
70
|
-
:'attachments' => :'Array<String>',
|
71
70
|
:'to' => :'Array<String>',
|
71
|
+
:'attachments' => :'Array<String>',
|
72
72
|
:'bcc' => :'Array<String>',
|
73
73
|
:'cc' => :'Array<String>',
|
74
74
|
:'created_at' => :'DateTime',
|
@@ -116,18 +116,18 @@ module MailSlurpClient
|
|
116
116
|
self.inbox_id = attributes[:'inbox_id']
|
117
117
|
end
|
118
118
|
|
119
|
-
if attributes.key?(:'attachments')
|
120
|
-
if (value = attributes[:'attachments']).is_a?(Array)
|
121
|
-
self.attachments = value
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
119
|
if attributes.key?(:'to')
|
126
120
|
if (value = attributes[:'to']).is_a?(Array)
|
127
121
|
self.to = value
|
128
122
|
end
|
129
123
|
end
|
130
124
|
|
125
|
+
if attributes.key?(:'attachments')
|
126
|
+
if (value = attributes[:'attachments']).is_a?(Array)
|
127
|
+
self.attachments = value
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
131
|
if attributes.key?(:'bcc')
|
132
132
|
if (value = attributes[:'bcc']).is_a?(Array)
|
133
133
|
self.bcc = value
|
@@ -203,8 +203,8 @@ module MailSlurpClient
|
|
203
203
|
from == o.from &&
|
204
204
|
subject == o.subject &&
|
205
205
|
inbox_id == o.inbox_id &&
|
206
|
-
attachments == o.attachments &&
|
207
206
|
to == o.to &&
|
207
|
+
attachments == o.attachments &&
|
208
208
|
bcc == o.bcc &&
|
209
209
|
cc == o.cc &&
|
210
210
|
created_at == o.created_at &&
|
@@ -223,7 +223,7 @@ module MailSlurpClient
|
|
223
223
|
# Calculates hash code according to all attributes.
|
224
224
|
# @return [Integer] Hash code
|
225
225
|
def hash
|
226
|
-
[id, from, subject, inbox_id,
|
226
|
+
[id, from, subject, inbox_id, to, attachments, bcc, cc, created_at, team_access, read, body_md5_hash, body_excerpt].hash
|
227
227
|
end
|
228
228
|
|
229
229
|
# Builds the object from hash
|
@@ -0,0 +1,261 @@
|
|
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
|
+
Contact: contact@mailslurp.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module MailSlurpClient
|
16
|
+
class ImapFlagOperationOptions
|
17
|
+
attr_accessor :flag_operation
|
18
|
+
|
19
|
+
attr_accessor :flags
|
20
|
+
|
21
|
+
class EnumAttributeValidator
|
22
|
+
attr_reader :datatype
|
23
|
+
attr_reader :allowable_values
|
24
|
+
|
25
|
+
def initialize(datatype, allowable_values)
|
26
|
+
@allowable_values = allowable_values.map do |value|
|
27
|
+
case datatype.to_s
|
28
|
+
when /Integer/i
|
29
|
+
value.to_i
|
30
|
+
when /Float/i
|
31
|
+
value.to_f
|
32
|
+
else
|
33
|
+
value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def valid?(value)
|
39
|
+
!value || allowable_values.include?(value)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
44
|
+
def self.attribute_map
|
45
|
+
{
|
46
|
+
:'flag_operation' => :'flagOperation',
|
47
|
+
:'flags' => :'flags'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute type mapping.
|
52
|
+
def self.openapi_types
|
53
|
+
{
|
54
|
+
:'flag_operation' => :'String',
|
55
|
+
:'flags' => :'Array<String>'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# List of attributes with nullable: true
|
60
|
+
def self.openapi_nullable
|
61
|
+
Set.new([
|
62
|
+
])
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
67
|
+
def initialize(attributes = {})
|
68
|
+
if (!attributes.is_a?(Hash))
|
69
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapFlagOperationOptions` initialize method"
|
70
|
+
end
|
71
|
+
|
72
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
74
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapFlagOperationOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
76
|
+
end
|
77
|
+
h[k.to_sym] = v
|
78
|
+
}
|
79
|
+
|
80
|
+
if attributes.key?(:'flag_operation')
|
81
|
+
self.flag_operation = attributes[:'flag_operation']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'flags')
|
85
|
+
if (value = attributes[:'flags']).is_a?(Array)
|
86
|
+
self.flags = value
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
if @flag_operation.nil?
|
96
|
+
invalid_properties.push('invalid value for "flag_operation", flag_operation cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
if @flags.nil?
|
100
|
+
invalid_properties.push('invalid value for "flags", flags cannot be nil.')
|
101
|
+
end
|
102
|
+
|
103
|
+
invalid_properties
|
104
|
+
end
|
105
|
+
|
106
|
+
# Check to see if the all the properties in the model are valid
|
107
|
+
# @return true if the model is valid
|
108
|
+
def valid?
|
109
|
+
return false if @flag_operation.nil?
|
110
|
+
flag_operation_validator = EnumAttributeValidator.new('String', ["SET_FLAGS", "ADD_FLAGS", "REMOVE_FLAGS"])
|
111
|
+
return false unless flag_operation_validator.valid?(@flag_operation)
|
112
|
+
return false if @flags.nil?
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Custom attribute writer method checking allowed values (enum).
|
117
|
+
# @param [Object] flag_operation Object to be assigned
|
118
|
+
def flag_operation=(flag_operation)
|
119
|
+
validator = EnumAttributeValidator.new('String', ["SET_FLAGS", "ADD_FLAGS", "REMOVE_FLAGS"])
|
120
|
+
unless validator.valid?(flag_operation)
|
121
|
+
fail ArgumentError, "invalid value for \"flag_operation\", must be one of #{validator.allowable_values}."
|
122
|
+
end
|
123
|
+
@flag_operation = flag_operation
|
124
|
+
end
|
125
|
+
|
126
|
+
# Checks equality by comparing each attribute.
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def ==(o)
|
129
|
+
return true if self.equal?(o)
|
130
|
+
self.class == o.class &&
|
131
|
+
flag_operation == o.flag_operation &&
|
132
|
+
flags == o.flags
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Integer] Hash code
|
143
|
+
def hash
|
144
|
+
[flag_operation, flags].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def self.build_from_hash(attributes)
|
151
|
+
new.build_from_hash(attributes)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
self.class.openapi_types.each_pair do |key, type|
|
160
|
+
if type =~ /\AArray<(.*)>/i
|
161
|
+
# check to ensure the input is an array given that the attribute
|
162
|
+
# is documented as an array but the input is not
|
163
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
164
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
165
|
+
end
|
166
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
167
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
168
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
169
|
+
end
|
170
|
+
|
171
|
+
self
|
172
|
+
end
|
173
|
+
|
174
|
+
# Deserializes the data based on type
|
175
|
+
# @param string type Data type
|
176
|
+
# @param string value Value to be deserialized
|
177
|
+
# @return [Object] Deserialized data
|
178
|
+
def _deserialize(type, value)
|
179
|
+
case type.to_sym
|
180
|
+
when :DateTime
|
181
|
+
DateTime.parse(value)
|
182
|
+
when :Date
|
183
|
+
Date.parse(value)
|
184
|
+
when :String
|
185
|
+
value.to_s
|
186
|
+
when :Integer
|
187
|
+
value.to_i
|
188
|
+
when :Float
|
189
|
+
value.to_f
|
190
|
+
when :Boolean
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
192
|
+
true
|
193
|
+
else
|
194
|
+
false
|
195
|
+
end
|
196
|
+
when :Object
|
197
|
+
# generic object (usually a Hash), return directly
|
198
|
+
value
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each do |k, v|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
else # model
|
211
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the string representation of the object
|
216
|
+
# @return [String] String presentation of the object
|
217
|
+
def to_s
|
218
|
+
to_hash.to_s
|
219
|
+
end
|
220
|
+
|
221
|
+
# to_body is an alias to to_hash (backward compatibility)
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_body
|
224
|
+
to_hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the object in the form of hash
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_hash
|
230
|
+
hash = {}
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
232
|
+
value = self.send(attr)
|
233
|
+
if value.nil?
|
234
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
235
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
236
|
+
end
|
237
|
+
|
238
|
+
hash[param] = _to_hash(value)
|
239
|
+
end
|
240
|
+
hash
|
241
|
+
end
|
242
|
+
|
243
|
+
# Outputs non-array value in the form of hash
|
244
|
+
# For object, use to_hash. Otherwise, just return the value
|
245
|
+
# @param [Object] value Any valid value
|
246
|
+
# @return [Hash] Returns the value in the form of hash
|
247
|
+
def _to_hash(value)
|
248
|
+
if value.is_a?(Array)
|
249
|
+
value.compact.map { |v| _to_hash(v) }
|
250
|
+
elsif value.is_a?(Hash)
|
251
|
+
{}.tap do |hash|
|
252
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
253
|
+
end
|
254
|
+
elsif value.respond_to? :to_hash
|
255
|
+
value.to_hash
|
256
|
+
else
|
257
|
+
value
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|