mailslurp_client 8.0.23 → 8.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +195 -3
- data/lib/mailslurp_client.rb +1 -0
- data/lib/mailslurp_client/api/email_controller_api.rb +74 -6
- data/lib/mailslurp_client/models/download_attachment_dto.rb +228 -0
- data/lib/mailslurp_client/models/inbox_projection.rb +5 -0
- data/lib/mailslurp_client/models/page_alias.rb +1 -0
- data/lib/mailslurp_client/models/page_contact_projection.rb +1 -0
- data/lib/mailslurp_client/models/page_email_preview.rb +1 -0
- data/lib/mailslurp_client/models/page_email_projection.rb +1 -0
- data/lib/mailslurp_client/models/page_group_projection.rb +1 -0
- data/lib/mailslurp_client/models/page_inbox_projection.rb +1 -0
- data/lib/mailslurp_client/models/page_sent_email_projection.rb +1 -0
- data/lib/mailslurp_client/models/page_template_projection.rb +1 -0
- data/lib/mailslurp_client/models/page_webhook_projection.rb +1 -0
- data/lib/mailslurp_client/models/upload_attachment_options.rb +1 -1
- data/lib/mailslurp_client/version.rb +1 -1
- 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: 14c8172e82d0cc82bc46542483fb851b2777335c4eb54763a5468963faff7bd2
|
4
|
+
data.tar.gz: 8256fcef95c9dec144f7ab4b2e3e6ea16d624a3e19823f6d1f42b85b29510f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8318ee26eb26b2851e543c5e1391da15b0222f11a914625ee064dbfd0f96cca44514a90496b2cf9f5aafab0705a3268829ecb4c45c630bb5b54972d669706356
|
7
|
+
data.tar.gz: b1e5948a5e6edd68b2b4b24d4d922c5d2b1fe3f45183137e38be5f8a999c91ab2aecb5b749912f76abba22cb3f56a1edc56983069bc148963f5b902535353171
|
data/README.md
CHANGED
@@ -39,15 +39,23 @@ gem install mailslurp_client
|
|
39
39
|
Or in your `Gemfile`:
|
40
40
|
|
41
41
|
```ruby
|
42
|
-
gem 'mailslurp_client', '~>
|
42
|
+
gem 'mailslurp_client', '~> 8.2', '>= 8.2.2'
|
43
43
|
```
|
44
44
|
|
45
|
+
And then run bundler install:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
gem install bundler
|
49
|
+
bundle install
|
50
|
+
```
|
51
|
+
|
52
|
+
|
45
53
|
### Configure the client
|
46
54
|
|
47
55
|
```ruby
|
48
56
|
require 'mailslurp_client'
|
49
57
|
|
50
|
-
# configure
|
58
|
+
# configure mailslurp client globally with API key (or pass each controller a client instance)
|
51
59
|
MailSlurpClient.configure do |config|
|
52
60
|
config.api_key['x-api-key'] = "YOUR_API_KEY_HERE"
|
53
61
|
end
|
@@ -80,6 +88,26 @@ it 'can create email addresses' do
|
|
80
88
|
end
|
81
89
|
```
|
82
90
|
|
91
|
+
### List inboxes
|
92
|
+
|
93
|
+
Inboxes you create can be listed in a paginated way.
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
it 'can list inboxes' do
|
97
|
+
inbox_controller = MailSlurpClient::InboxControllerApi.new
|
98
|
+
paged_inboxes = inbox_controller.get_all_inboxes({ page: 0, size: 20 })
|
99
|
+
|
100
|
+
# assert on pagination fields
|
101
|
+
expect(paged_inboxes.content).not_to be_empty
|
102
|
+
expect(paged_inboxes.number).to be(0)
|
103
|
+
expect(paged_inboxes.size).to be(20)
|
104
|
+
|
105
|
+
# can access inbox result
|
106
|
+
expect(paged_inboxes.content[0].id).not_to be_empty
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
110
|
+
|
83
111
|
### Send emails
|
84
112
|
|
85
113
|
You can send HTML emails easily with the inbox controller. First create an inbox then use its ID with the `send_email` method.
|
@@ -104,6 +132,24 @@ inbox_controller.send_email(inbox.id, {
|
|
104
132
|
})
|
105
133
|
```
|
106
134
|
|
135
|
+
You can also use objects for most method options:
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
# for send options see https://github.com/mailslurp/mailslurp-client-ruby/blob/master/docs/SendEmailOptions.md
|
139
|
+
opts = {
|
140
|
+
send_email_options: MailSlurpClient::SendEmailOptions.new(
|
141
|
+
{
|
142
|
+
to: [inbox_2.email_address],
|
143
|
+
subject: 'Test email',
|
144
|
+
from: inbox_1.email_address,
|
145
|
+
body: 'Test email content',
|
146
|
+
is_html: true,
|
147
|
+
attachments: attachment_ids
|
148
|
+
}
|
149
|
+
)
|
150
|
+
}
|
151
|
+
inbox_controller.send_email(inbox_1.id, opts)
|
152
|
+
```
|
107
153
|
### Receive emails
|
108
154
|
|
109
155
|
You can use MailSlurp to wait for at least 1 unread email in an inbox and return it.
|
@@ -111,13 +157,159 @@ If a timeout is exceeded it will throw an error instead:
|
|
111
157
|
|
112
158
|
```ruby
|
113
159
|
waitfor_controller = MailSlurpClient::WaitForControllerApi.new
|
114
|
-
email = waitfor_controller.wait_for_latest_email({ inbox_id: inbox.id, unread_only: true })
|
160
|
+
email = waitfor_controller.wait_for_latest_email({ inbox_id: inbox.id, unread_only: true, timeout: 30_000 })
|
115
161
|
|
116
162
|
# verify email contents
|
117
163
|
expect(email.subject).to include("Test")
|
118
164
|
expect(email.body).to include("Your email body")
|
119
165
|
```
|
120
166
|
|
167
|
+
### Attachments
|
168
|
+
|
169
|
+
You can send attachments by first uploading files with the `AttachmentControllerApi` then using the returned attachment IDs in the send email method.
|
170
|
+
|
171
|
+
::: tip
|
172
|
+
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.
|
173
|
+
:::
|
174
|
+
|
175
|
+
#### Upload and send
|
176
|
+
```ruby
|
177
|
+
# upload a file to mailslurp to use as attachment
|
178
|
+
# @return [Array<String>]
|
179
|
+
def upload_file
|
180
|
+
# read a file to upload
|
181
|
+
data = File.open(PATH_TO_ATTACHMENT).read
|
182
|
+
|
183
|
+
# encode the data as base64 string (must be strict to avoid ruby adding new line characters)
|
184
|
+
encoded = Base64.strict_encode64(data)
|
185
|
+
|
186
|
+
attachment_controller = MailSlurpClient::AttachmentControllerApi.new
|
187
|
+
upload_options = MailSlurpClient::UploadAttachmentOptions.new(
|
188
|
+
{
|
189
|
+
base64_contents: encoded,
|
190
|
+
content_type: 'text/plain',
|
191
|
+
filename: 'attachment.txt'
|
192
|
+
}
|
193
|
+
)
|
194
|
+
|
195
|
+
# return list of attachment ids
|
196
|
+
attachment_controller.upload_attachment(upload_options)
|
197
|
+
end
|
198
|
+
```
|
199
|
+
|
200
|
+
To send attachments
|
201
|
+
|
202
|
+
```ruby
|
203
|
+
attachment_ids = upload_file
|
204
|
+
|
205
|
+
opts = {
|
206
|
+
send_email_options: MailSlurpClient::SendEmailOptions.new(
|
207
|
+
{
|
208
|
+
to: [inbox_2.email_address],
|
209
|
+
subject: 'Test email',
|
210
|
+
from: inbox_1.email_address,
|
211
|
+
body: 'Test email content',
|
212
|
+
is_html: true,
|
213
|
+
attachments: attachment_ids
|
214
|
+
}
|
215
|
+
)
|
216
|
+
}
|
217
|
+
inbox_controller.send_email(inbox_1.id, opts)
|
218
|
+
```
|
219
|
+
|
220
|
+
#### Download received attachments
|
221
|
+
```ruby
|
222
|
+
# wait for the email to arrive (or fetch directly using email controller if you know it is there)
|
223
|
+
wait_opts = {
|
224
|
+
inbox_id: inbox_2.id,
|
225
|
+
timeout: 30_000,
|
226
|
+
unread_only: true
|
227
|
+
}
|
228
|
+
email = wait_controller.wait_for_latest_email(wait_opts)
|
229
|
+
|
230
|
+
# find the attachments on the email object
|
231
|
+
expect(email.attachments.size).to be(1)
|
232
|
+
|
233
|
+
# download the attachment
|
234
|
+
email_controller = MailSlurpClient::EmailControllerApi.new
|
235
|
+
downloaded_attachment = email_controller.download_attachment_base64(email.attachments[0], email.id)
|
236
|
+
|
237
|
+
# extract attachment content
|
238
|
+
expect(downloaded_attachment.content_type).to eq("text/plain")
|
239
|
+
expect(downloaded_attachment.size_bytes).to be_truthy
|
240
|
+
expect(downloaded_attachment.base64_file_contents).to be_truthy
|
241
|
+
```
|
242
|
+
|
243
|
+
## Examples
|
244
|
+
|
245
|
+
### Send email between two inboxes
|
246
|
+
|
247
|
+
It is common to use MailSlurp in test environments. Here is an example RSpec test:
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
|
251
|
+
require 'mailslurp_client'
|
252
|
+
|
253
|
+
# read mailslurp api key from environment variables
|
254
|
+
API_KEY = ENV['API_KEY']
|
255
|
+
|
256
|
+
describe 'use MailSlurp ruby sdk to create email addresses then send and receive email' do
|
257
|
+
before(:all) do
|
258
|
+
expect(API_KEY).to be_truthy
|
259
|
+
|
260
|
+
# configure mailslurp with API key
|
261
|
+
MailSlurpClient.configure do |config|
|
262
|
+
config.api_key['x-api-key'] = API_KEY
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'can an inbox with an email address' do
|
267
|
+
# create a new email address
|
268
|
+
inbox_controller = MailSlurpClient::InboxControllerApi.new
|
269
|
+
inbox = inbox_controller.create_inbox
|
270
|
+
|
271
|
+
# has a mailslurp email address
|
272
|
+
expect(inbox.id).to be_truthy
|
273
|
+
expect(inbox.email_address).to include('@mailslurp.com')
|
274
|
+
end
|
275
|
+
|
276
|
+
it 'can send and receive emails' do
|
277
|
+
inbox_controller = MailSlurpClient::InboxControllerApi.new
|
278
|
+
wait_controller = MailSlurpClient::WaitForControllerApi.new
|
279
|
+
|
280
|
+
# create two inboxes
|
281
|
+
inbox_1 = inbox_controller.create_inbox
|
282
|
+
inbox_2 = inbox_controller.create_inbox
|
283
|
+
|
284
|
+
# send email from inbox 1 to inbox 2 (you can send emails to any address)
|
285
|
+
# for send options see https://github.com/mailslurp/mailslurp-client-ruby/blob/master/docs/SendEmailOptions.md
|
286
|
+
opts = {
|
287
|
+
send_email_options: MailSlurpClient::SendEmailOptions.new(
|
288
|
+
{
|
289
|
+
to: [inbox_2.email_address],
|
290
|
+
subject: 'Test email',
|
291
|
+
from: inbox_1.email_address,
|
292
|
+
body: 'Test email content',
|
293
|
+
is_html: true
|
294
|
+
}
|
295
|
+
)
|
296
|
+
}
|
297
|
+
inbox_controller.send_email(inbox_1.id, opts)
|
298
|
+
|
299
|
+
expect(inbox_2.id).to be_truthy
|
300
|
+
|
301
|
+
# now wait for the email to arrive
|
302
|
+
wait_opts = {
|
303
|
+
inbox_id: inbox_2.id,
|
304
|
+
timeout: 30_000,
|
305
|
+
unread_only: true
|
306
|
+
}
|
307
|
+
email = wait_controller.wait_for_latest_email(wait_opts)
|
308
|
+
expect(email.body).to include('Test email content')
|
309
|
+
end
|
310
|
+
end
|
311
|
+
```
|
312
|
+
|
121
313
|
## SDK Documentation
|
122
314
|
|
123
315
|
See the [examples page](https://www.mailslurp.com/examples/) or the full [Method Documentation](./docs) on Github.
|
data/lib/mailslurp_client.rb
CHANGED
@@ -33,6 +33,7 @@ require 'mailslurp_client/models/describe_domain_options'
|
|
33
33
|
require 'mailslurp_client/models/describe_mail_server_domain_result'
|
34
34
|
require 'mailslurp_client/models/domain_dto'
|
35
35
|
require 'mailslurp_client/models/domain_preview'
|
36
|
+
require 'mailslurp_client/models/download_attachment_dto'
|
36
37
|
require 'mailslurp_client/models/email'
|
37
38
|
require 'mailslurp_client/models/email_analysis'
|
38
39
|
require 'mailslurp_client/models/email_preview'
|
@@ -133,24 +133,24 @@ module MailSlurpClient
|
|
133
133
|
return data, status_code, headers
|
134
134
|
end
|
135
135
|
|
136
|
-
# Get email attachment bytes
|
137
|
-
# Returns the specified attachment for a given email as a
|
136
|
+
# Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
|
137
|
+
# Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
|
138
138
|
# @param attachment_id [String] attachmentId
|
139
139
|
# @param email_id [String] emailId
|
140
140
|
# @param [Hash] opts the optional parameters
|
141
|
-
# @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser
|
141
|
+
# @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.
|
142
142
|
# @return [String]
|
143
143
|
def download_attachment(attachment_id, email_id, opts = {})
|
144
144
|
data, _status_code, _headers = download_attachment_with_http_info(attachment_id, email_id, opts)
|
145
145
|
data
|
146
146
|
end
|
147
147
|
|
148
|
-
# Get email attachment bytes
|
149
|
-
# Returns the specified attachment for a given email as a
|
148
|
+
# Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
|
149
|
+
# Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
|
150
150
|
# @param attachment_id [String] attachmentId
|
151
151
|
# @param email_id [String] emailId
|
152
152
|
# @param [Hash] opts the optional parameters
|
153
|
-
# @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser
|
153
|
+
# @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.
|
154
154
|
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
155
155
|
def download_attachment_with_http_info(attachment_id, email_id, opts = {})
|
156
156
|
if @api_client.config.debugging
|
@@ -204,6 +204,74 @@ module MailSlurpClient
|
|
204
204
|
return data, status_code, headers
|
205
205
|
end
|
206
206
|
|
207
|
+
# Get email attachment as base64 encoded string (alternative to binary responses)
|
208
|
+
# 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.
|
209
|
+
# @param attachment_id [String] attachmentId
|
210
|
+
# @param email_id [String] emailId
|
211
|
+
# @param [Hash] opts the optional parameters
|
212
|
+
# @return [DownloadAttachmentDto]
|
213
|
+
def download_attachment_base64(attachment_id, email_id, opts = {})
|
214
|
+
data, _status_code, _headers = download_attachment_base64_with_http_info(attachment_id, email_id, opts)
|
215
|
+
data
|
216
|
+
end
|
217
|
+
|
218
|
+
# Get email attachment as base64 encoded string (alternative to binary responses)
|
219
|
+
# 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.
|
220
|
+
# @param attachment_id [String] attachmentId
|
221
|
+
# @param email_id [String] emailId
|
222
|
+
# @param [Hash] opts the optional parameters
|
223
|
+
# @return [Array<(DownloadAttachmentDto, Integer, Hash)>] DownloadAttachmentDto data, response status code and response headers
|
224
|
+
def download_attachment_base64_with_http_info(attachment_id, email_id, opts = {})
|
225
|
+
if @api_client.config.debugging
|
226
|
+
@api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment_base64 ...'
|
227
|
+
end
|
228
|
+
# verify the required parameter 'attachment_id' is set
|
229
|
+
if @api_client.config.client_side_validation && attachment_id.nil?
|
230
|
+
fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment_base64"
|
231
|
+
end
|
232
|
+
# verify the required parameter 'email_id' is set
|
233
|
+
if @api_client.config.client_side_validation && email_id.nil?
|
234
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment_base64"
|
235
|
+
end
|
236
|
+
# resource path
|
237
|
+
local_var_path = '/emails/{emailId}/attachments/{attachmentId}/base64'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
|
238
|
+
|
239
|
+
# query parameters
|
240
|
+
query_params = opts[:query_params] || {}
|
241
|
+
|
242
|
+
# header parameters
|
243
|
+
header_params = opts[:header_params] || {}
|
244
|
+
# HTTP header 'Accept' (if needed)
|
245
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
246
|
+
|
247
|
+
# form parameters
|
248
|
+
form_params = opts[:form_params] || {}
|
249
|
+
|
250
|
+
# http body (model)
|
251
|
+
post_body = opts[:body]
|
252
|
+
|
253
|
+
# return_type
|
254
|
+
return_type = opts[:return_type] || 'DownloadAttachmentDto'
|
255
|
+
|
256
|
+
# auth_names
|
257
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
258
|
+
|
259
|
+
new_options = opts.merge(
|
260
|
+
:header_params => header_params,
|
261
|
+
:query_params => query_params,
|
262
|
+
:form_params => form_params,
|
263
|
+
:body => post_body,
|
264
|
+
:auth_names => auth_names,
|
265
|
+
:return_type => return_type
|
266
|
+
)
|
267
|
+
|
268
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
269
|
+
if @api_client.config.debugging
|
270
|
+
@api_client.config.logger.debug "API called: EmailControllerApi#download_attachment_base64\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
271
|
+
end
|
272
|
+
return data, status_code, headers
|
273
|
+
end
|
274
|
+
|
207
275
|
# Forward email
|
208
276
|
# Forward an existing email to new recipients.
|
209
277
|
# @param email_id [String] emailId
|
@@ -0,0 +1,228 @@
|
|
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
|
+
# Content of attachment
|
17
|
+
class DownloadAttachmentDto
|
18
|
+
# Base64 encoded string of attachment bytes. Decode the base64 string to get the raw file bytes
|
19
|
+
attr_accessor :base64_file_contents
|
20
|
+
|
21
|
+
# Content type of attachment
|
22
|
+
attr_accessor :content_type
|
23
|
+
|
24
|
+
# Size in bytes of attachment
|
25
|
+
attr_accessor :size_bytes
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'base64_file_contents' => :'base64FileContents',
|
31
|
+
:'content_type' => :'contentType',
|
32
|
+
:'size_bytes' => :'sizeBytes'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.openapi_types
|
38
|
+
{
|
39
|
+
:'base64_file_contents' => :'String',
|
40
|
+
:'content_type' => :'String',
|
41
|
+
:'size_bytes' => :'Integer'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::DownloadAttachmentDto` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::DownloadAttachmentDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'base64_file_contents')
|
67
|
+
self.base64_file_contents = attributes[:'base64_file_contents']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'content_type')
|
71
|
+
self.content_type = attributes[:'content_type']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'size_bytes')
|
75
|
+
self.size_bytes = attributes[:'size_bytes']
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
base64_file_contents == o.base64_file_contents &&
|
98
|
+
content_type == o.content_type &&
|
99
|
+
size_bytes == o.size_bytes
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Integer] Hash code
|
110
|
+
def hash
|
111
|
+
[base64_file_contents, content_type, size_bytes].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def self.build_from_hash(attributes)
|
118
|
+
new.build_from_hash(attributes)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
124
|
+
def build_from_hash(attributes)
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
126
|
+
self.class.openapi_types.each_pair do |key, type|
|
127
|
+
if type =~ /\AArray<(.*)>/i
|
128
|
+
# check to ensure the input is an array given that the attribute
|
129
|
+
# is documented as an array but the input is not
|
130
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
132
|
+
end
|
133
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def _deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :DateTime
|
148
|
+
DateTime.parse(value)
|
149
|
+
when :Date
|
150
|
+
Date.parse(value)
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :Boolean
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else # model
|
178
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
@@ -106,6 +106,10 @@ module MailSlurpClient
|
|
106
106
|
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
107
107
|
end
|
108
108
|
|
109
|
+
if @favourite.nil?
|
110
|
+
invalid_properties.push('invalid value for "favourite", favourite cannot be nil.')
|
111
|
+
end
|
112
|
+
|
109
113
|
if @id.nil?
|
110
114
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
111
115
|
end
|
@@ -117,6 +121,7 @@ module MailSlurpClient
|
|
117
121
|
# @return true if the model is valid
|
118
122
|
def valid?
|
119
123
|
return false if @created_at.nil?
|
124
|
+
return false if @favourite.nil?
|
120
125
|
return false if @id.nil?
|
121
126
|
true
|
122
127
|
end
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated email alias results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full inbox entity use the projection ID with individual method calls.
|
16
17
|
class PageAlias
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated contact results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full inbox entity use the projection ID with individual method calls.
|
16
17
|
class PageContactProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated email preview results. EmailProjections and EmailPreviews are essentially the same but have legacy naming issues. 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. For emails there are several methods for fetching message bodies and attachments.
|
16
17
|
class PageEmailPreview
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated email projection results. EmailProjections and EmailPreviews are essentially the same but have legacy naming issues. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full email entity use the projection ID with individual method calls. For emails there are several methods for fetching message bodies and attachments.
|
16
17
|
class PageEmailProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated contact group results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full inbox entity use the projection ID with individual method calls.
|
16
17
|
class PageGroupProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated inbox results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full inbox entity use the projection ID with individual method calls.
|
16
17
|
class PageInboxProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated sent email results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full sent email entity use the projection ID with individual method calls.
|
16
17
|
class PageSentEmailProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated email template results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full inbox entity use the projection ID with individual method calls.
|
16
17
|
class PageTemplateProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Paginated webhook results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full inbox entity use the projection ID with individual method calls.
|
16
17
|
class PageWebhookProjection
|
17
18
|
attr_accessor :content
|
18
19
|
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module MailSlurpClient
|
16
16
|
# Options for uploading files for attachments. When sending emails with the API that require attachments first upload each attachment. Then use the returned attachment ID in your `SendEmailOptions` when sending an email. This way you can use attachments multiple times once they have been uploaded.
|
17
17
|
class UploadAttachmentOptions
|
18
|
-
# Base64 encoded string of file contents
|
18
|
+
# Base64 encoded string of file contents. Typically this means reading the bytes or string content of a file and then converting that to a base64 encoded string.
|
19
19
|
attr_accessor :base64_contents
|
20
20
|
|
21
21
|
# Optional contentType for file. For instance `application/pdf`
|
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: 8.
|
4
|
+
version: 8.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mailslurp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-20 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.
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/mailslurp_client/models/describe_mail_server_domain_result.rb
|
58
58
|
- lib/mailslurp_client/models/domain_dto.rb
|
59
59
|
- lib/mailslurp_client/models/domain_preview.rb
|
60
|
+
- lib/mailslurp_client/models/download_attachment_dto.rb
|
60
61
|
- lib/mailslurp_client/models/email.rb
|
61
62
|
- lib/mailslurp_client/models/email_analysis.rb
|
62
63
|
- lib/mailslurp_client/models/email_preview.rb
|