mailslurp_client 8.1.0 → 8.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e09565223846183fdb2a82a4ffbcfcc87ed4cf1157e32e94300c1f5eaf5be18
4
- data.tar.gz: 6399d456aec4cae1ad35269cd69febaf523b0d99fb2e83f2ef4b38959d4b92d0
3
+ metadata.gz: eb26b371795f3c3f22153005061495dfdfe9aafbfb19343c9e5fd0a2cad8f08c
4
+ data.tar.gz: 6c1f6040f0fda56d86d3f3f99f3fba6323e296310bd5979426c546f0a0e6a34b
5
5
  SHA512:
6
- metadata.gz: c8aa61a184591e959fe8bfbd8db112f1f87885ff48286c9196996417ada4b7535568d1c639f2e0350d001ce94f981d003a05602e2b8574ed914b5f8fca6ac933
7
- data.tar.gz: '0803e299e25b2862f19bd94534789432ab7635cdac52f7faf7e808bf99267a63e3cc4cad729a4b4642049549da9a0a1d06e9b41f73b78dc14669fc0dde86f7bf'
6
+ metadata.gz: 2863d470ac5561ccd4d3f752cb2c5b91e5ec31c55e12cf04a72cd879ad43e0cade733e789554be4ca6857ee33a558b1fadf73bc9f8e7e6a6d3d348fc56dbeda9
7
+ data.tar.gz: c2bce2df5ca712385a06876be952313c369dd1324a2baa48917a253acdd6a5e465a214d1bed6dccf22274c7fd961c4a5748fbf7cb37b119dcd6d5b7d757ebd73
data/README.md CHANGED
@@ -13,11 +13,13 @@ MailSlurp is an email API service that lets you create real email addresses in c
13
13
  ## Get started
14
14
 
15
15
  ::: tip
16
+
16
17
  This section describes how to get up and running with the Ruby client.
17
18
 
18
19
  See the [examples page](https://www.mailslurp.com/examples/) for more examples and use with common frameworks such as Rails and RSpec.
19
20
 
20
21
  See the method documentation for a [list of all functions](./docs)
22
+
21
23
  :::
22
24
 
23
25
  ### Create API Key
@@ -39,15 +41,23 @@ gem install mailslurp_client
39
41
  Or in your `Gemfile`:
40
42
 
41
43
  ```ruby
42
- gem 'mailslurp_client', '~> 7.0', '>= 7.0.8'
44
+ gem 'mailslurp_client', '~> 8.2', '>= 8.2.2'
45
+ ```
46
+
47
+ And then run bundler install:
48
+
49
+ ```bash
50
+ gem install bundler
51
+ bundle install
43
52
  ```
44
53
 
54
+
45
55
  ### Configure the client
46
56
 
47
57
  ```ruby
48
58
  require 'mailslurp_client'
49
59
 
50
- # configure the mailslurp client with an API Key
60
+ # configure mailslurp client globally with API key (or pass each controller a client instance)
51
61
  MailSlurpClient.configure do |config|
52
62
  config.api_key['x-api-key'] = "YOUR_API_KEY_HERE"
53
63
  end
@@ -80,6 +90,26 @@ it 'can create email addresses' do
80
90
  end
81
91
  ```
82
92
 
93
+ ### List inboxes
94
+
95
+ Inboxes you create can be listed in a paginated way.
96
+
97
+ ```ruby
98
+ it 'can list inboxes' do
99
+ inbox_controller = MailSlurpClient::InboxControllerApi.new
100
+ paged_inboxes = inbox_controller.get_all_inboxes({ page: 0, size: 20 })
101
+
102
+ # assert on pagination fields
103
+ expect(paged_inboxes.content).not_to be_empty
104
+ expect(paged_inboxes.number).to be(0)
105
+ expect(paged_inboxes.size).to be(20)
106
+
107
+ # can access inbox result
108
+ expect(paged_inboxes.content[0].id).not_to be_empty
109
+ end
110
+ ```
111
+
112
+
83
113
  ### Send emails
84
114
 
85
115
  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 +134,24 @@ inbox_controller.send_email(inbox.id, {
104
134
  })
105
135
  ```
106
136
 
137
+ You can also use objects for most method options:
138
+
139
+ ```ruby
140
+ # for send options see https://github.com/mailslurp/mailslurp-client-ruby/blob/master/docs/SendEmailOptions.md
141
+ opts = {
142
+ send_email_options: MailSlurpClient::SendEmailOptions.new(
143
+ {
144
+ to: [inbox_2.email_address],
145
+ subject: 'Test email',
146
+ from: inbox_1.email_address,
147
+ body: 'Test email content',
148
+ is_html: true,
149
+ attachments: attachment_ids
150
+ }
151
+ )
152
+ }
153
+ inbox_controller.send_email(inbox_1.id, opts)
154
+ ```
107
155
  ### Receive emails
108
156
 
109
157
  You can use MailSlurp to wait for at least 1 unread email in an inbox and return it.
@@ -111,13 +159,161 @@ If a timeout is exceeded it will throw an error instead:
111
159
 
112
160
  ```ruby
113
161
  waitfor_controller = MailSlurpClient::WaitForControllerApi.new
114
- email = waitfor_controller.wait_for_latest_email({ inbox_id: inbox.id, unread_only: true })
162
+ email = waitfor_controller.wait_for_latest_email({ inbox_id: inbox.id, unread_only: true, timeout: 30_000 })
115
163
 
116
164
  # verify email contents
117
165
  expect(email.subject).to include("Test")
118
166
  expect(email.body).to include("Your email body")
119
167
  ```
120
168
 
169
+ ### Attachments
170
+
171
+ You can send attachments by first uploading files with the `AttachmentControllerApi` then using the returned attachment IDs in the send email method.
172
+
173
+ ::: tip
174
+
175
+ 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.
176
+
177
+ :::
178
+
179
+ #### Upload and send
180
+ ```ruby
181
+ # upload a file to mailslurp to use as attachment
182
+ # @return [Array<String>]
183
+ def upload_file
184
+ # read a file to upload
185
+ data = File.open(PATH_TO_ATTACHMENT).read
186
+
187
+ # encode the data as base64 string (must be strict to avoid ruby adding new line characters)
188
+ encoded = Base64.strict_encode64(data)
189
+
190
+ attachment_controller = MailSlurpClient::AttachmentControllerApi.new
191
+ upload_options = MailSlurpClient::UploadAttachmentOptions.new(
192
+ {
193
+ base64_contents: encoded,
194
+ content_type: 'text/plain',
195
+ filename: 'attachment.txt'
196
+ }
197
+ )
198
+
199
+ # return list of attachment ids
200
+ attachment_controller.upload_attachment(upload_options)
201
+ end
202
+ ```
203
+
204
+ To send attachments
205
+
206
+ ```ruby
207
+ attachment_ids = upload_file
208
+
209
+ opts = {
210
+ send_email_options: MailSlurpClient::SendEmailOptions.new(
211
+ {
212
+ to: [inbox_2.email_address],
213
+ subject: 'Test email',
214
+ from: inbox_1.email_address,
215
+ body: 'Test email content',
216
+ is_html: true,
217
+ attachments: attachment_ids
218
+ }
219
+ )
220
+ }
221
+ inbox_controller.send_email(inbox_1.id, opts)
222
+ ```
223
+
224
+ #### Download received attachments
225
+ ```ruby
226
+ # wait for the email to arrive (or fetch directly using email controller if you know it is there)
227
+ wait_opts = {
228
+ inbox_id: inbox_2.id,
229
+ timeout: 30_000,
230
+ unread_only: true
231
+ }
232
+ email = wait_controller.wait_for_latest_email(wait_opts)
233
+
234
+ # find the attachments on the email object
235
+ expect(email.attachments.size).to be(1)
236
+
237
+ # download the attachment
238
+ email_controller = MailSlurpClient::EmailControllerApi.new
239
+ downloaded_attachment = email_controller.download_attachment_base64(email.attachments[0], email.id)
240
+
241
+ # extract attachment content
242
+ expect(downloaded_attachment.content_type).to eq("text/plain")
243
+ expect(downloaded_attachment.size_bytes).to be_truthy
244
+ expect(downloaded_attachment.base64_file_contents).to be_truthy
245
+ ```
246
+
247
+ ## Examples
248
+
249
+ ### Send email between two inboxes
250
+
251
+ It is common to use MailSlurp in test environments. Here is an example RSpec test:
252
+
253
+ ```ruby
254
+
255
+ require 'mailslurp_client'
256
+
257
+ # read mailslurp api key from environment variables
258
+ API_KEY = ENV['API_KEY']
259
+
260
+ describe 'use MailSlurp ruby sdk to create email addresses then send and receive email' do
261
+ before(:all) do
262
+ expect(API_KEY).to be_truthy
263
+
264
+ # configure mailslurp with API key
265
+ MailSlurpClient.configure do |config|
266
+ config.api_key['x-api-key'] = API_KEY
267
+ end
268
+ end
269
+
270
+ it 'can an inbox with an email address' do
271
+ # create a new email address
272
+ inbox_controller = MailSlurpClient::InboxControllerApi.new
273
+ inbox = inbox_controller.create_inbox
274
+
275
+ # has a mailslurp email address
276
+ expect(inbox.id).to be_truthy
277
+ expect(inbox.email_address).to include('@mailslurp.com')
278
+ end
279
+
280
+ it 'can send and receive emails' do
281
+ inbox_controller = MailSlurpClient::InboxControllerApi.new
282
+ wait_controller = MailSlurpClient::WaitForControllerApi.new
283
+
284
+ # create two inboxes
285
+ inbox_1 = inbox_controller.create_inbox
286
+ inbox_2 = inbox_controller.create_inbox
287
+
288
+ # send email from inbox 1 to inbox 2 (you can send emails to any address)
289
+ # for send options see https://github.com/mailslurp/mailslurp-client-ruby/blob/master/docs/SendEmailOptions.md
290
+ opts = {
291
+ send_email_options: MailSlurpClient::SendEmailOptions.new(
292
+ {
293
+ to: [inbox_2.email_address],
294
+ subject: 'Test email',
295
+ from: inbox_1.email_address,
296
+ body: 'Test email content',
297
+ is_html: true
298
+ }
299
+ )
300
+ }
301
+ inbox_controller.send_email(inbox_1.id, opts)
302
+
303
+ expect(inbox_2.id).to be_truthy
304
+
305
+ # now wait for the email to arrive
306
+ wait_opts = {
307
+ inbox_id: inbox_2.id,
308
+ timeout: 30_000,
309
+ unread_only: true
310
+ }
311
+ email = wait_controller.wait_for_latest_email(wait_opts)
312
+ expect(email.body).to include('Test email content')
313
+ end
314
+ end
315
+ ```
316
+
121
317
  ## SDK Documentation
122
318
 
123
319
  See the [examples page](https://www.mailslurp.com/examples/) or the full [Method Documentation](./docs) on Github.
@@ -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 byte stream (file download). You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
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 byte stream (file download). You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
148
+ # Get email attachment bytes. If you have trouble with byte responses try the &#x60;downloadAttachmentBase64&#x60; 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 &#x60;downloadAttachment&#x60; 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
@@ -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`
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module MailSlurpClient
14
- VERSION = '8.1.0'
14
+ VERSION = '8.2.5'
15
15
  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: 8.1.0
4
+ version: 8.2.5
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-19 00:00:00.000000000 Z
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