mailslurp_client 4.3.3 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +1 -1
- data/README.md +19 -6
- data/docs/CommonOperationsApi.md +337 -4
- data/docs/Email.md +2 -0
- data/docs/EmailPreview.md +4 -0
- data/docs/ExtraOperationsApi.md +173 -7
- data/docs/ForwardEmailOptions.md +11 -0
- data/docs/MatchOption.md +10 -0
- data/docs/MatchOptions.md +8 -0
- data/docs/SendEmailOptions.md +3 -1
- data/docs/UploadAttachmentOptions.md +10 -0
- data/lib/mailslurp_client.rb +4 -0
- data/lib/mailslurp_client/api/common_operations_api.rb +331 -4
- data/lib/mailslurp_client/api/extra_operations_api.rb +183 -8
- data/lib/mailslurp_client/models/email.rb +19 -1
- data/lib/mailslurp_client/models/email_preview.rb +51 -4
- data/lib/mailslurp_client/models/forward_email_options.rb +222 -0
- data/lib/mailslurp_client/models/match_option.rb +250 -0
- data/lib/mailslurp_client/models/match_options.rb +187 -0
- data/lib/mailslurp_client/models/send_email_options.rb +24 -2
- data/lib/mailslurp_client/models/upload_attachment_options.rb +205 -0
- data/lib/mailslurp_client/version.rb +1 -1
- data/spec/api/common_operations_api_spec.rb +24 -0
- data/spec/api/extra_operations_api_spec.rb +1 -1
- data/spec/models/forward_email_options_spec.rb +59 -0
- data/spec/models/match_option_spec.rb +61 -0
- data/spec/models/match_options_spec.rb +41 -0
- data/spec/models/upload_attachment_options_spec.rb +53 -0
- metadata +23 -7
@@ -227,7 +227,7 @@ module MailSlurpClient
|
|
227
227
|
# Attach a WebHook URL to an inbox
|
228
228
|
# Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint.
|
229
229
|
# @param inbox_id inboxId
|
230
|
-
# @param create_webhook_options
|
230
|
+
# @param create_webhook_options webhookOptions
|
231
231
|
# @param [Hash] opts the optional parameters
|
232
232
|
# @return [Webhook]
|
233
233
|
def create_webhook(inbox_id, create_webhook_options, opts = {})
|
@@ -238,7 +238,7 @@ module MailSlurpClient
|
|
238
238
|
# Attach a WebHook URL to an inbox
|
239
239
|
# Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint.
|
240
240
|
# @param inbox_id inboxId
|
241
|
-
# @param create_webhook_options
|
241
|
+
# @param create_webhook_options webhookOptions
|
242
242
|
# @param [Hash] opts the optional parameters
|
243
243
|
# @return [Array<(Webhook, Fixnum, Hash)>] Webhook data, response status code and response headers
|
244
244
|
def create_webhook_with_http_info(inbox_id, create_webhook_options, opts = {})
|
@@ -290,8 +290,8 @@ module MailSlurpClient
|
|
290
290
|
# @param email_id emailId
|
291
291
|
# @param [Hash] opts the optional parameters
|
292
292
|
# @return [nil]
|
293
|
-
def
|
294
|
-
|
293
|
+
def delete_email1(email_id, opts = {})
|
294
|
+
delete_email1_with_http_info(email_id, opts)
|
295
295
|
nil
|
296
296
|
end
|
297
297
|
|
@@ -300,13 +300,13 @@ module MailSlurpClient
|
|
300
300
|
# @param email_id emailId
|
301
301
|
# @param [Hash] opts the optional parameters
|
302
302
|
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
303
|
-
def
|
303
|
+
def delete_email1_with_http_info(email_id, opts = {})
|
304
304
|
if @api_client.config.debugging
|
305
|
-
@api_client.config.logger.debug 'Calling API: ExtraOperationsApi.
|
305
|
+
@api_client.config.logger.debug 'Calling API: ExtraOperationsApi.delete_email1 ...'
|
306
306
|
end
|
307
307
|
# verify the required parameter 'email_id' is set
|
308
308
|
if @api_client.config.client_side_validation && email_id.nil?
|
309
|
-
fail ArgumentError, "Missing the required parameter 'email_id' when calling ExtraOperationsApi.
|
309
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling ExtraOperationsApi.delete_email1"
|
310
310
|
end
|
311
311
|
# resource path
|
312
312
|
local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', email_id.to_s)
|
@@ -330,7 +330,7 @@ module MailSlurpClient
|
|
330
330
|
:body => post_body,
|
331
331
|
:auth_names => auth_names)
|
332
332
|
if @api_client.config.debugging
|
333
|
-
@api_client.config.logger.debug "API called: ExtraOperationsApi#
|
333
|
+
@api_client.config.logger.debug "API called: ExtraOperationsApi#delete_email1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
334
334
|
end
|
335
335
|
return data, status_code, headers
|
336
336
|
end
|
@@ -495,6 +495,64 @@ module MailSlurpClient
|
|
495
495
|
return data, status_code, headers
|
496
496
|
end
|
497
497
|
|
498
|
+
# Forward Email
|
499
|
+
# Forward email content to given recipients
|
500
|
+
# @param email_id emailId
|
501
|
+
# @param forward_email_options forwardEmailOptions
|
502
|
+
# @param [Hash] opts the optional parameters
|
503
|
+
# @return [nil]
|
504
|
+
def forward_email(email_id, forward_email_options, opts = {})
|
505
|
+
forward_email_with_http_info(email_id, forward_email_options, opts)
|
506
|
+
nil
|
507
|
+
end
|
508
|
+
|
509
|
+
# Forward Email
|
510
|
+
# Forward email content to given recipients
|
511
|
+
# @param email_id emailId
|
512
|
+
# @param forward_email_options forwardEmailOptions
|
513
|
+
# @param [Hash] opts the optional parameters
|
514
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
515
|
+
def forward_email_with_http_info(email_id, forward_email_options, opts = {})
|
516
|
+
if @api_client.config.debugging
|
517
|
+
@api_client.config.logger.debug 'Calling API: ExtraOperationsApi.forward_email ...'
|
518
|
+
end
|
519
|
+
# verify the required parameter 'email_id' is set
|
520
|
+
if @api_client.config.client_side_validation && email_id.nil?
|
521
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling ExtraOperationsApi.forward_email"
|
522
|
+
end
|
523
|
+
# verify the required parameter 'forward_email_options' is set
|
524
|
+
if @api_client.config.client_side_validation && forward_email_options.nil?
|
525
|
+
fail ArgumentError, "Missing the required parameter 'forward_email_options' when calling ExtraOperationsApi.forward_email"
|
526
|
+
end
|
527
|
+
# resource path
|
528
|
+
local_var_path = '/emails/{emailId}/forward'.sub('{' + 'emailId' + '}', email_id.to_s)
|
529
|
+
|
530
|
+
# query parameters
|
531
|
+
query_params = {}
|
532
|
+
|
533
|
+
# header parameters
|
534
|
+
header_params = {}
|
535
|
+
# HTTP header 'Content-Type'
|
536
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
537
|
+
|
538
|
+
# form parameters
|
539
|
+
form_params = {}
|
540
|
+
|
541
|
+
# http body (model)
|
542
|
+
post_body = @api_client.object_to_http_body(forward_email_options)
|
543
|
+
auth_names = ['API_KEY']
|
544
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
545
|
+
:header_params => header_params,
|
546
|
+
:query_params => query_params,
|
547
|
+
:form_params => form_params,
|
548
|
+
:body => post_body,
|
549
|
+
:auth_names => auth_names)
|
550
|
+
if @api_client.config.debugging
|
551
|
+
@api_client.config.logger.debug "API called: ExtraOperationsApi#forward_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
552
|
+
end
|
553
|
+
return data, status_code, headers
|
554
|
+
end
|
555
|
+
|
498
556
|
# Get Email Content
|
499
557
|
# Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawMessage endpoint
|
500
558
|
# @param email_id emailId
|
@@ -875,5 +933,122 @@ module MailSlurpClient
|
|
875
933
|
return data, status_code, headers
|
876
934
|
end
|
877
935
|
|
936
|
+
# Upload an attachment for sending
|
937
|
+
# When sending emails with attachments first upload each attachment with this endpoint. Record the returned attachment IDs. Then use these attachment IDs in the SendEmailOptions when sending an email. This means that attachments can easily be reused.
|
938
|
+
# @param upload_attachment_options uploadOptions
|
939
|
+
# @param [Hash] opts the optional parameters
|
940
|
+
# @return [Array<String>]
|
941
|
+
def upload_attachment(upload_attachment_options, opts = {})
|
942
|
+
data, _status_code, _headers = upload_attachment_with_http_info(upload_attachment_options, opts)
|
943
|
+
data
|
944
|
+
end
|
945
|
+
|
946
|
+
# Upload an attachment for sending
|
947
|
+
# When sending emails with attachments first upload each attachment with this endpoint. Record the returned attachment IDs. Then use these attachment IDs in the SendEmailOptions when sending an email. This means that attachments can easily be reused.
|
948
|
+
# @param upload_attachment_options uploadOptions
|
949
|
+
# @param [Hash] opts the optional parameters
|
950
|
+
# @return [Array<(Array<String>, Fixnum, Hash)>] Array<String> data, response status code and response headers
|
951
|
+
def upload_attachment_with_http_info(upload_attachment_options, opts = {})
|
952
|
+
if @api_client.config.debugging
|
953
|
+
@api_client.config.logger.debug 'Calling API: ExtraOperationsApi.upload_attachment ...'
|
954
|
+
end
|
955
|
+
# verify the required parameter 'upload_attachment_options' is set
|
956
|
+
if @api_client.config.client_side_validation && upload_attachment_options.nil?
|
957
|
+
fail ArgumentError, "Missing the required parameter 'upload_attachment_options' when calling ExtraOperationsApi.upload_attachment"
|
958
|
+
end
|
959
|
+
# resource path
|
960
|
+
local_var_path = '/attachments'
|
961
|
+
|
962
|
+
# query parameters
|
963
|
+
query_params = {}
|
964
|
+
|
965
|
+
# header parameters
|
966
|
+
header_params = {}
|
967
|
+
# HTTP header 'Accept' (if needed)
|
968
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
969
|
+
# HTTP header 'Content-Type'
|
970
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
971
|
+
|
972
|
+
# form parameters
|
973
|
+
form_params = {}
|
974
|
+
|
975
|
+
# http body (model)
|
976
|
+
post_body = @api_client.object_to_http_body(upload_attachment_options)
|
977
|
+
auth_names = ['API_KEY']
|
978
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
979
|
+
:header_params => header_params,
|
980
|
+
:query_params => query_params,
|
981
|
+
:form_params => form_params,
|
982
|
+
:body => post_body,
|
983
|
+
:auth_names => auth_names,
|
984
|
+
:return_type => 'Array<String>')
|
985
|
+
if @api_client.config.debugging
|
986
|
+
@api_client.config.logger.debug "API called: ExtraOperationsApi#upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
987
|
+
end
|
988
|
+
return data, status_code, headers
|
989
|
+
end
|
990
|
+
|
991
|
+
# Upload an attachment for sending using Multipart Form
|
992
|
+
# When sending emails with attachments first upload each attachment with this endpoint. Record the returned attachment IDs. Then use these attachment IDs in the SendEmailOptions when sending an email. This means that attachments can easily be reused.
|
993
|
+
# @param file file
|
994
|
+
# @param [Hash] opts the optional parameters
|
995
|
+
# @option opts [String] :content_type contentType
|
996
|
+
# @option opts [String] :filename filename
|
997
|
+
# @return [Array<String>]
|
998
|
+
def upload_multipart_form(file, opts = {})
|
999
|
+
data, _status_code, _headers = upload_multipart_form_with_http_info(file, opts)
|
1000
|
+
data
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
# Upload an attachment for sending using Multipart Form
|
1004
|
+
# When sending emails with attachments first upload each attachment with this endpoint. Record the returned attachment IDs. Then use these attachment IDs in the SendEmailOptions when sending an email. This means that attachments can easily be reused.
|
1005
|
+
# @param file file
|
1006
|
+
# @param [Hash] opts the optional parameters
|
1007
|
+
# @option opts [String] :content_type contentType
|
1008
|
+
# @option opts [String] :filename filename
|
1009
|
+
# @return [Array<(Array<String>, Fixnum, Hash)>] Array<String> data, response status code and response headers
|
1010
|
+
def upload_multipart_form_with_http_info(file, opts = {})
|
1011
|
+
if @api_client.config.debugging
|
1012
|
+
@api_client.config.logger.debug 'Calling API: ExtraOperationsApi.upload_multipart_form ...'
|
1013
|
+
end
|
1014
|
+
# verify the required parameter 'file' is set
|
1015
|
+
if @api_client.config.client_side_validation && file.nil?
|
1016
|
+
fail ArgumentError, "Missing the required parameter 'file' when calling ExtraOperationsApi.upload_multipart_form"
|
1017
|
+
end
|
1018
|
+
# resource path
|
1019
|
+
local_var_path = '/attachments/multipart'
|
1020
|
+
|
1021
|
+
# query parameters
|
1022
|
+
query_params = {}
|
1023
|
+
query_params[:'contentType'] = opts[:'content_type'] if !opts[:'content_type'].nil?
|
1024
|
+
query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil?
|
1025
|
+
|
1026
|
+
# header parameters
|
1027
|
+
header_params = {}
|
1028
|
+
# HTTP header 'Accept' (if needed)
|
1029
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1030
|
+
# HTTP header 'Content-Type'
|
1031
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
1032
|
+
|
1033
|
+
# form parameters
|
1034
|
+
form_params = {}
|
1035
|
+
form_params['file'] = file
|
1036
|
+
|
1037
|
+
# http body (model)
|
1038
|
+
post_body = nil
|
1039
|
+
auth_names = ['API_KEY']
|
1040
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
1041
|
+
:header_params => header_params,
|
1042
|
+
:query_params => query_params,
|
1043
|
+
:form_params => form_params,
|
1044
|
+
:body => post_body,
|
1045
|
+
:auth_names => auth_names,
|
1046
|
+
:return_type => 'Array<String>')
|
1047
|
+
if @api_client.config.debugging
|
1048
|
+
@api_client.config.logger.debug "API called: ExtraOperationsApi#upload_multipart_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1049
|
+
end
|
1050
|
+
return data, status_code, headers
|
1051
|
+
end
|
1052
|
+
|
878
1053
|
end
|
879
1054
|
end
|
@@ -25,12 +25,16 @@ module MailSlurpClient
|
|
25
25
|
|
26
26
|
attr_accessor :cc
|
27
27
|
|
28
|
+
attr_accessor :charset
|
29
|
+
|
28
30
|
attr_accessor :created_at
|
29
31
|
|
30
32
|
attr_accessor :from
|
31
33
|
|
32
34
|
attr_accessor :headers
|
33
35
|
|
36
|
+
attr_accessor :html
|
37
|
+
|
34
38
|
attr_accessor :id
|
35
39
|
|
36
40
|
attr_accessor :inbox_id
|
@@ -53,9 +57,11 @@ module MailSlurpClient
|
|
53
57
|
:'bcc' => :'bcc',
|
54
58
|
:'body' => :'body',
|
55
59
|
:'cc' => :'cc',
|
60
|
+
:'charset' => :'charset',
|
56
61
|
:'created_at' => :'createdAt',
|
57
62
|
:'from' => :'from',
|
58
63
|
:'headers' => :'headers',
|
64
|
+
:'html' => :'html',
|
59
65
|
:'id' => :'id',
|
60
66
|
:'inbox_id' => :'inboxId',
|
61
67
|
:'raw_url' => :'rawUrl',
|
@@ -74,9 +80,11 @@ module MailSlurpClient
|
|
74
80
|
:'bcc' => :'Array<String>',
|
75
81
|
:'body' => :'String',
|
76
82
|
:'cc' => :'Array<String>',
|
83
|
+
:'charset' => :'String',
|
77
84
|
:'created_at' => :'DateTime',
|
78
85
|
:'from' => :'String',
|
79
86
|
:'headers' => :'Hash<String, String>',
|
87
|
+
:'html' => :'BOOLEAN',
|
80
88
|
:'id' => :'String',
|
81
89
|
:'inbox_id' => :'String',
|
82
90
|
:'raw_url' => :'String',
|
@@ -121,6 +129,10 @@ module MailSlurpClient
|
|
121
129
|
end
|
122
130
|
end
|
123
131
|
|
132
|
+
if attributes.has_key?(:'charset')
|
133
|
+
self.charset = attributes[:'charset']
|
134
|
+
end
|
135
|
+
|
124
136
|
if attributes.has_key?(:'createdAt')
|
125
137
|
self.created_at = attributes[:'createdAt']
|
126
138
|
end
|
@@ -135,6 +147,10 @@ module MailSlurpClient
|
|
135
147
|
end
|
136
148
|
end
|
137
149
|
|
150
|
+
if attributes.has_key?(:'html')
|
151
|
+
self.html = attributes[:'html']
|
152
|
+
end
|
153
|
+
|
138
154
|
if attributes.has_key?(:'id')
|
139
155
|
self.id = attributes[:'id']
|
140
156
|
end
|
@@ -219,9 +235,11 @@ module MailSlurpClient
|
|
219
235
|
bcc == o.bcc &&
|
220
236
|
body == o.body &&
|
221
237
|
cc == o.cc &&
|
238
|
+
charset == o.charset &&
|
222
239
|
created_at == o.created_at &&
|
223
240
|
from == o.from &&
|
224
241
|
headers == o.headers &&
|
242
|
+
html == o.html &&
|
225
243
|
id == o.id &&
|
226
244
|
inbox_id == o.inbox_id &&
|
227
245
|
raw_url == o.raw_url &&
|
@@ -240,7 +258,7 @@ module MailSlurpClient
|
|
240
258
|
# Calculates hash code according to all attributes.
|
241
259
|
# @return [Fixnum] Hash code
|
242
260
|
def hash
|
243
|
-
[analysis, attachments, bcc, body, cc, created_at, from, headers, id, inbox_id, raw_url, subject, to, updated_at, user_id].hash
|
261
|
+
[analysis, attachments, bcc, body, cc, charset, created_at, from, headers, html, id, inbox_id, raw_url, subject, to, updated_at, user_id].hash
|
244
262
|
end
|
245
263
|
|
246
264
|
# Builds the object from hash
|
@@ -15,23 +15,39 @@ require 'date'
|
|
15
15
|
module MailSlurpClient
|
16
16
|
# Preview of an email message. For full message call the message endpoint with a given message id.
|
17
17
|
class EmailPreview
|
18
|
+
attr_accessor :bcc
|
19
|
+
|
20
|
+
attr_accessor :cc
|
21
|
+
|
18
22
|
attr_accessor :created
|
19
23
|
|
20
24
|
attr_accessor :id
|
21
25
|
|
26
|
+
attr_accessor :subject
|
27
|
+
|
28
|
+
attr_accessor :to
|
29
|
+
|
22
30
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
31
|
def self.attribute_map
|
24
32
|
{
|
33
|
+
:'bcc' => :'bcc',
|
34
|
+
:'cc' => :'cc',
|
25
35
|
:'created' => :'created',
|
26
|
-
:'id' => :'id'
|
36
|
+
:'id' => :'id',
|
37
|
+
:'subject' => :'subject',
|
38
|
+
:'to' => :'to'
|
27
39
|
}
|
28
40
|
end
|
29
41
|
|
30
42
|
# Attribute type mapping.
|
31
43
|
def self.openapi_types
|
32
44
|
{
|
45
|
+
:'bcc' => :'Array<String>',
|
46
|
+
:'cc' => :'Array<String>',
|
33
47
|
:'created' => :'DateTime',
|
34
|
-
:'id' => :'String'
|
48
|
+
:'id' => :'String',
|
49
|
+
:'subject' => :'String',
|
50
|
+
:'to' => :'Array<String>'
|
35
51
|
}
|
36
52
|
end
|
37
53
|
|
@@ -43,6 +59,18 @@ module MailSlurpClient
|
|
43
59
|
# convert string to symbol for hash key
|
44
60
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
45
61
|
|
62
|
+
if attributes.has_key?(:'bcc')
|
63
|
+
if (value = attributes[:'bcc']).is_a?(Array)
|
64
|
+
self.bcc = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'cc')
|
69
|
+
if (value = attributes[:'cc']).is_a?(Array)
|
70
|
+
self.cc = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
46
74
|
if attributes.has_key?(:'created')
|
47
75
|
self.created = attributes[:'created']
|
48
76
|
end
|
@@ -50,6 +78,16 @@ module MailSlurpClient
|
|
50
78
|
if attributes.has_key?(:'id')
|
51
79
|
self.id = attributes[:'id']
|
52
80
|
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'subject')
|
83
|
+
self.subject = attributes[:'subject']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'to')
|
87
|
+
if (value = attributes[:'to']).is_a?(Array)
|
88
|
+
self.to = value
|
89
|
+
end
|
90
|
+
end
|
53
91
|
end
|
54
92
|
|
55
93
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -64,6 +102,10 @@ module MailSlurpClient
|
|
64
102
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
65
103
|
end
|
66
104
|
|
105
|
+
if @to.nil?
|
106
|
+
invalid_properties.push('invalid value for "to", to cannot be nil.')
|
107
|
+
end
|
108
|
+
|
67
109
|
invalid_properties
|
68
110
|
end
|
69
111
|
|
@@ -72,6 +114,7 @@ module MailSlurpClient
|
|
72
114
|
def valid?
|
73
115
|
return false if @created.nil?
|
74
116
|
return false if @id.nil?
|
117
|
+
return false if @to.nil?
|
75
118
|
true
|
76
119
|
end
|
77
120
|
|
@@ -80,8 +123,12 @@ module MailSlurpClient
|
|
80
123
|
def ==(o)
|
81
124
|
return true if self.equal?(o)
|
82
125
|
self.class == o.class &&
|
126
|
+
bcc == o.bcc &&
|
127
|
+
cc == o.cc &&
|
83
128
|
created == o.created &&
|
84
|
-
id == o.id
|
129
|
+
id == o.id &&
|
130
|
+
subject == o.subject &&
|
131
|
+
to == o.to
|
85
132
|
end
|
86
133
|
|
87
134
|
# @see the `==` method
|
@@ -93,7 +140,7 @@ module MailSlurpClient
|
|
93
140
|
# Calculates hash code according to all attributes.
|
94
141
|
# @return [Fixnum] Hash code
|
95
142
|
def hash
|
96
|
-
[created, id].hash
|
143
|
+
[bcc, cc, created, id, subject, to].hash
|
97
144
|
end
|
98
145
|
|
99
146
|
# Builds the object from hash
|
@@ -0,0 +1,222 @@
|
|
1
|
+
=begin
|
2
|
+
#MailSlurp API
|
3
|
+
|
4
|
+
#For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.1-alpha
|
7
|
+
Contact: contact@mailslurp.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 3.3.4
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module MailSlurpClient
|
16
|
+
# Options for forwarding an email
|
17
|
+
class ForwardEmailOptions
|
18
|
+
attr_accessor :to
|
19
|
+
|
20
|
+
attr_accessor :subject
|
21
|
+
|
22
|
+
attr_accessor :cc
|
23
|
+
|
24
|
+
attr_accessor :bcc
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'to' => :'to',
|
30
|
+
:'subject' => :'subject',
|
31
|
+
:'cc' => :'cc',
|
32
|
+
:'bcc' => :'bcc'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.openapi_types
|
38
|
+
{
|
39
|
+
:'to' => :'Array<String>',
|
40
|
+
:'subject' => :'String',
|
41
|
+
:'cc' => :'Array<String>',
|
42
|
+
:'bcc' => :'Array<String>'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
53
|
+
|
54
|
+
if attributes.has_key?(:'to')
|
55
|
+
if (value = attributes[:'to']).is_a?(Array)
|
56
|
+
self.to = value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'subject')
|
61
|
+
self.subject = attributes[:'subject']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'cc')
|
65
|
+
if (value = attributes[:'cc']).is_a?(Array)
|
66
|
+
self.cc = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'bcc')
|
71
|
+
if (value = attributes[:'bcc']).is_a?(Array)
|
72
|
+
self.bcc = value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
invalid_properties = Array.new
|
81
|
+
if @to.nil?
|
82
|
+
invalid_properties.push('invalid value for "to", to cannot be nil.')
|
83
|
+
end
|
84
|
+
|
85
|
+
invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
return false if @to.nil?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks equality by comparing each attribute.
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def ==(o)
|
98
|
+
return true if self.equal?(o)
|
99
|
+
self.class == o.class &&
|
100
|
+
to == o.to &&
|
101
|
+
subject == o.subject &&
|
102
|
+
cc == o.cc &&
|
103
|
+
bcc == o.bcc
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Fixnum] Hash code
|
114
|
+
def hash
|
115
|
+
[to, subject, cc, bcc].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.openapi_types.each_pair do |key, type|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :DateTime
|
145
|
+
DateTime.parse(value)
|
146
|
+
when :Date
|
147
|
+
Date.parse(value)
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :BOOLEAN
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
156
|
+
true
|
157
|
+
else
|
158
|
+
false
|
159
|
+
end
|
160
|
+
when :Object
|
161
|
+
# generic object (usually a Hash), return directly
|
162
|
+
value
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
169
|
+
{}.tap do |hash|
|
170
|
+
value.each do |k, v|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
else # model
|
175
|
+
temp_model = MailSlurpClient.const_get(type).new
|
176
|
+
temp_model.build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
next if value.nil?
|
199
|
+
hash[param] = _to_hash(value)
|
200
|
+
end
|
201
|
+
hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map { |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|