mailslurp_client 8.2.17 → 8.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -2
- data/lib/mailslurp_client.rb +6 -2
- data/lib/mailslurp_client/api/alias_controller_api.rb +34 -96
- data/lib/mailslurp_client/api/domain_controller_api.rb +7 -5
- data/lib/mailslurp_client/api/email_controller_api.rb +70 -0
- data/lib/mailslurp_client/api/form_controller_api.rb +4 -7
- data/lib/mailslurp_client/api/inbox_controller_api.rb +64 -0
- data/lib/mailslurp_client/models/alias_dto.rb +299 -0
- data/lib/mailslurp_client/models/alias_projection.rb +300 -0
- data/lib/mailslurp_client/models/{create_owned_alias_options.rb → create_alias_options.rb} +13 -13
- data/lib/mailslurp_client/models/create_inbox_dto.rb +259 -0
- data/lib/mailslurp_client/models/domain_dto.rb +16 -16
- data/lib/mailslurp_client/models/email.rb +11 -1
- data/lib/mailslurp_client/models/model_alias.rb +20 -10
- data/lib/mailslurp_client/models/page_alias.rb +1 -1
- data/lib/mailslurp_client/models/reply_to_email_options.rb +314 -0
- data/lib/mailslurp_client/models/{create_anonymous_alias_options.rb → update_alias_options.rb} +12 -12
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +8 -4
@@ -20,15 +20,14 @@ module MailSlurpClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
# Submit a form to be parsed and sent as an email to an address determined by the form fields
|
23
|
-
# This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a `_to` email address
|
23
|
+
# This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a `_to` email address to tell the endpoint where the form should be emailed. These can be submitted as hidden HTML input fields with the corresponding `name` attributes or as URL query parameters such as `?_to=test@example.com` The endpoint takes all other form fields that are named and includes them in the message body of the email. Files are sent as attachments. #### Submitting This endpoint accepts form submission via POST method. It accepts `application/x-www-form-urlencoded`, and `multipart/form-data` content-types. #### HTML Example ```html <form action=\"https://api.mailslurp.com/forms\" method=\"post\" > <input name=\"_to\" type=\"hidden\" value=\"test@example.com\"/> <textarea name=\"feedback\"></textarea> <button type=\"submit\">Submit</button> </form> ``` #### URL Example ```html <form action=\"https://api.mailslurp.com/forms?_to=test@example.com\" method=\"post\" > <textarea name=\"feedback\"></textarea> <button type=\"submit\">Submit</button> </form> ``` The email address is specified by a `_to` field OR is extracted from an email alias specified by a `_toAlias` field (see the alias controller for more information). Endpoint accepts . You can specify a content type in HTML forms using the `enctype` attribute, for instance: `<form enctype=\"multipart/form-data\">`.
|
24
24
|
# @param [Hash] opts the optional parameters
|
25
25
|
# @option opts [String] :_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later.
|
26
26
|
# @option opts [String] :_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message.
|
27
27
|
# @option opts [String] :_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored.
|
28
28
|
# @option opts [String] :_subject Optional subject of the email that will be sent.
|
29
29
|
# @option opts [String] :_success_message Optional success message to display if no _redirectTo present.
|
30
|
-
# @option opts [String] :_to The email address that submitted form should be sent to.
|
31
|
-
# @option opts [String] :_to_alias ID of an email alias to that form should be sent to. Aliases must be created before submission and can be used to hide an email address and reduce spam.
|
30
|
+
# @option opts [String] :_to The email address that submitted form should be sent to.
|
32
31
|
# @option opts [String] :other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent.
|
33
32
|
# @return [String]
|
34
33
|
def submit_form(opts = {})
|
@@ -37,15 +36,14 @@ module MailSlurpClient
|
|
37
36
|
end
|
38
37
|
|
39
38
|
# Submit a form to be parsed and sent as an email to an address determined by the form fields
|
40
|
-
# This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a `_to` email address
|
39
|
+
# This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a `_to` email address to tell the endpoint where the form should be emailed. These can be submitted as hidden HTML input fields with the corresponding `name` attributes or as URL query parameters such as `?_to=test@example.com` The endpoint takes all other form fields that are named and includes them in the message body of the email. Files are sent as attachments. #### Submitting This endpoint accepts form submission via POST method. It accepts `application/x-www-form-urlencoded`, and `multipart/form-data` content-types. #### HTML Example ```html <form action=\"https://api.mailslurp.com/forms\" method=\"post\" > <input name=\"_to\" type=\"hidden\" value=\"test@example.com\"/> <textarea name=\"feedback\"></textarea> <button type=\"submit\">Submit</button> </form> ``` #### URL Example ```html <form action=\"https://api.mailslurp.com/forms?_to=test@example.com\" method=\"post\" > <textarea name=\"feedback\"></textarea> <button type=\"submit\">Submit</button> </form> ``` The email address is specified by a `_to` field OR is extracted from an email alias specified by a `_toAlias` field (see the alias controller for more information). Endpoint accepts . You can specify a content type in HTML forms using the `enctype` attribute, for instance: `<form enctype=\"multipart/form-data\">`.
|
41
40
|
# @param [Hash] opts the optional parameters
|
42
41
|
# @option opts [String] :_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later.
|
43
42
|
# @option opts [String] :_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message.
|
44
43
|
# @option opts [String] :_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored.
|
45
44
|
# @option opts [String] :_subject Optional subject of the email that will be sent.
|
46
45
|
# @option opts [String] :_success_message Optional success message to display if no _redirectTo present.
|
47
|
-
# @option opts [String] :_to The email address that submitted form should be sent to.
|
48
|
-
# @option opts [String] :_to_alias ID of an email alias to that form should be sent to. Aliases must be created before submission and can be used to hide an email address and reduce spam.
|
46
|
+
# @option opts [String] :_to The email address that submitted form should be sent to.
|
49
47
|
# @option opts [String] :other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent.
|
50
48
|
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
51
49
|
def submit_form_with_http_info(opts = {})
|
@@ -73,7 +71,6 @@ module MailSlurpClient
|
|
73
71
|
form_params['_subject'] = opts[:'_subject'] if !opts[:'_subject'].nil?
|
74
72
|
form_params['_successMessage'] = opts[:'_success_message'] if !opts[:'_success_message'].nil?
|
75
73
|
form_params['_to'] = opts[:'_to'] if !opts[:'_to'].nil?
|
76
|
-
form_params['_toAlias'] = opts[:'_to_alias'] if !opts[:'_to_alias'].nil?
|
77
74
|
form_params['otherParameters'] = opts[:'other_parameters'] if !opts[:'other_parameters'].nil?
|
78
75
|
|
79
76
|
# http body (model)
|
@@ -93,6 +93,70 @@ module MailSlurpClient
|
|
93
93
|
return data, status_code, headers
|
94
94
|
end
|
95
95
|
|
96
|
+
# Create an inbox with additional options
|
97
|
+
# Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients.
|
98
|
+
# @param create_inbox_dto [CreateInboxDto] createInboxDto
|
99
|
+
# @param [Hash] opts the optional parameters
|
100
|
+
# @return [Inbox]
|
101
|
+
def create_inbox_with_options(create_inbox_dto, opts = {})
|
102
|
+
data, _status_code, _headers = create_inbox_with_options_with_http_info(create_inbox_dto, opts)
|
103
|
+
data
|
104
|
+
end
|
105
|
+
|
106
|
+
# Create an inbox with additional options
|
107
|
+
# Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients.
|
108
|
+
# @param create_inbox_dto [CreateInboxDto] createInboxDto
|
109
|
+
# @param [Hash] opts the optional parameters
|
110
|
+
# @return [Array<(Inbox, Integer, Hash)>] Inbox data, response status code and response headers
|
111
|
+
def create_inbox_with_options_with_http_info(create_inbox_dto, opts = {})
|
112
|
+
if @api_client.config.debugging
|
113
|
+
@api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_with_options ...'
|
114
|
+
end
|
115
|
+
# verify the required parameter 'create_inbox_dto' is set
|
116
|
+
if @api_client.config.client_side_validation && create_inbox_dto.nil?
|
117
|
+
fail ArgumentError, "Missing the required parameter 'create_inbox_dto' when calling InboxControllerApi.create_inbox_with_options"
|
118
|
+
end
|
119
|
+
# resource path
|
120
|
+
local_var_path = '/inboxes/withOptions'
|
121
|
+
|
122
|
+
# query parameters
|
123
|
+
query_params = opts[:query_params] || {}
|
124
|
+
|
125
|
+
# header parameters
|
126
|
+
header_params = opts[:header_params] || {}
|
127
|
+
# HTTP header 'Accept' (if needed)
|
128
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
129
|
+
# HTTP header 'Content-Type'
|
130
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
131
|
+
|
132
|
+
# form parameters
|
133
|
+
form_params = opts[:form_params] || {}
|
134
|
+
|
135
|
+
# http body (model)
|
136
|
+
post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_dto)
|
137
|
+
|
138
|
+
# return_type
|
139
|
+
return_type = opts[:return_type] || 'Inbox'
|
140
|
+
|
141
|
+
# auth_names
|
142
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
143
|
+
|
144
|
+
new_options = opts.merge(
|
145
|
+
:header_params => header_params,
|
146
|
+
:query_params => query_params,
|
147
|
+
:form_params => form_params,
|
148
|
+
:body => post_body,
|
149
|
+
:auth_names => auth_names,
|
150
|
+
:return_type => return_type
|
151
|
+
)
|
152
|
+
|
153
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
154
|
+
if @api_client.config.debugging
|
155
|
+
@api_client.config.logger.debug "API called: InboxControllerApi#create_inbox_with_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
156
|
+
end
|
157
|
+
return data, status_code, headers
|
158
|
+
end
|
159
|
+
|
96
160
|
# Delete all inboxes
|
97
161
|
# Permanently delete all inboxes and associated email addresses. This will also delete all emails within the inboxes. Be careful as inboxes cannot be recovered once deleted. Note: deleting inboxes will not impact your usage limits. Monthly inbox creation limits are based on how many inboxes were created in the last 30 days, not how many inboxes you currently have.
|
98
162
|
# @param [Hash] opts the optional parameters
|
@@ -0,0 +1,299 @@
|
|
1
|
+
=begin
|
2
|
+
#MailSlurp API
|
3
|
+
|
4
|
+
#MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 6.5.2
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module MailSlurpClient
|
16
|
+
# Email alias representation
|
17
|
+
class AliasDto
|
18
|
+
attr_accessor :created_at
|
19
|
+
|
20
|
+
attr_accessor :email_address
|
21
|
+
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
attr_accessor :inbox_id
|
25
|
+
|
26
|
+
attr_accessor :is_verified
|
27
|
+
|
28
|
+
attr_accessor :name
|
29
|
+
|
30
|
+
attr_accessor :updated_at
|
31
|
+
|
32
|
+
attr_accessor :use_threads
|
33
|
+
|
34
|
+
attr_accessor :user_id
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'created_at' => :'createdAt',
|
40
|
+
:'email_address' => :'emailAddress',
|
41
|
+
:'id' => :'id',
|
42
|
+
:'inbox_id' => :'inboxId',
|
43
|
+
:'is_verified' => :'isVerified',
|
44
|
+
:'name' => :'name',
|
45
|
+
:'updated_at' => :'updatedAt',
|
46
|
+
:'use_threads' => :'useThreads',
|
47
|
+
:'user_id' => :'userId'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute type mapping.
|
52
|
+
def self.openapi_types
|
53
|
+
{
|
54
|
+
:'created_at' => :'DateTime',
|
55
|
+
:'email_address' => :'String',
|
56
|
+
:'id' => :'String',
|
57
|
+
:'inbox_id' => :'String',
|
58
|
+
:'is_verified' => :'Boolean',
|
59
|
+
:'name' => :'String',
|
60
|
+
:'updated_at' => :'DateTime',
|
61
|
+
:'use_threads' => :'Boolean',
|
62
|
+
:'user_id' => :'String'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# List of attributes with nullable: true
|
67
|
+
def self.openapi_nullable
|
68
|
+
Set.new([
|
69
|
+
])
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
if (!attributes.is_a?(Hash))
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::AliasDto` initialize method"
|
77
|
+
end
|
78
|
+
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
81
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::AliasDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
83
|
+
end
|
84
|
+
h[k.to_sym] = v
|
85
|
+
}
|
86
|
+
|
87
|
+
if attributes.key?(:'created_at')
|
88
|
+
self.created_at = attributes[:'created_at']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'email_address')
|
92
|
+
self.email_address = attributes[:'email_address']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'id')
|
96
|
+
self.id = attributes[:'id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'inbox_id')
|
100
|
+
self.inbox_id = attributes[:'inbox_id']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'is_verified')
|
104
|
+
self.is_verified = attributes[:'is_verified']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'name')
|
108
|
+
self.name = attributes[:'name']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'updated_at')
|
112
|
+
self.updated_at = attributes[:'updated_at']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'use_threads')
|
116
|
+
self.use_threads = attributes[:'use_threads']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'user_id')
|
120
|
+
self.user_id = attributes[:'user_id']
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
if @id.nil?
|
129
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @inbox_id.nil?
|
133
|
+
invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @is_verified.nil?
|
137
|
+
invalid_properties.push('invalid value for "is_verified", is_verified cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @user_id.nil?
|
141
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
invalid_properties
|
145
|
+
end
|
146
|
+
|
147
|
+
# Check to see if the all the properties in the model are valid
|
148
|
+
# @return true if the model is valid
|
149
|
+
def valid?
|
150
|
+
return false if @id.nil?
|
151
|
+
return false if @inbox_id.nil?
|
152
|
+
return false if @is_verified.nil?
|
153
|
+
return false if @user_id.nil?
|
154
|
+
true
|
155
|
+
end
|
156
|
+
|
157
|
+
# Checks equality by comparing each attribute.
|
158
|
+
# @param [Object] Object to be compared
|
159
|
+
def ==(o)
|
160
|
+
return true if self.equal?(o)
|
161
|
+
self.class == o.class &&
|
162
|
+
created_at == o.created_at &&
|
163
|
+
email_address == o.email_address &&
|
164
|
+
id == o.id &&
|
165
|
+
inbox_id == o.inbox_id &&
|
166
|
+
is_verified == o.is_verified &&
|
167
|
+
name == o.name &&
|
168
|
+
updated_at == o.updated_at &&
|
169
|
+
use_threads == o.use_threads &&
|
170
|
+
user_id == o.user_id
|
171
|
+
end
|
172
|
+
|
173
|
+
# @see the `==` method
|
174
|
+
# @param [Object] Object to be compared
|
175
|
+
def eql?(o)
|
176
|
+
self == o
|
177
|
+
end
|
178
|
+
|
179
|
+
# Calculates hash code according to all attributes.
|
180
|
+
# @return [Integer] Hash code
|
181
|
+
def hash
|
182
|
+
[created_at, email_address, id, inbox_id, is_verified, name, updated_at, use_threads, user_id].hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Builds the object from hash
|
186
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
187
|
+
# @return [Object] Returns the model itself
|
188
|
+
def self.build_from_hash(attributes)
|
189
|
+
new.build_from_hash(attributes)
|
190
|
+
end
|
191
|
+
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def build_from_hash(attributes)
|
196
|
+
return nil unless attributes.is_a?(Hash)
|
197
|
+
self.class.openapi_types.each_pair do |key, type|
|
198
|
+
if type =~ /\AArray<(.*)>/i
|
199
|
+
# check to ensure the input is an array given that the attribute
|
200
|
+
# is documented as an array but the input is not
|
201
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
202
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
203
|
+
end
|
204
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
205
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
206
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
207
|
+
end
|
208
|
+
|
209
|
+
self
|
210
|
+
end
|
211
|
+
|
212
|
+
# Deserializes the data based on type
|
213
|
+
# @param string type Data type
|
214
|
+
# @param string value Value to be deserialized
|
215
|
+
# @return [Object] Deserialized data
|
216
|
+
def _deserialize(type, value)
|
217
|
+
case type.to_sym
|
218
|
+
when :DateTime
|
219
|
+
DateTime.parse(value)
|
220
|
+
when :Date
|
221
|
+
Date.parse(value)
|
222
|
+
when :String
|
223
|
+
value.to_s
|
224
|
+
when :Integer
|
225
|
+
value.to_i
|
226
|
+
when :Float
|
227
|
+
value.to_f
|
228
|
+
when :Boolean
|
229
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
230
|
+
true
|
231
|
+
else
|
232
|
+
false
|
233
|
+
end
|
234
|
+
when :Object
|
235
|
+
# generic object (usually a Hash), return directly
|
236
|
+
value
|
237
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
238
|
+
inner_type = Regexp.last_match[:inner_type]
|
239
|
+
value.map { |v| _deserialize(inner_type, v) }
|
240
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
241
|
+
k_type = Regexp.last_match[:k_type]
|
242
|
+
v_type = Regexp.last_match[:v_type]
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each do |k, v|
|
245
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
else # model
|
249
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
# Returns the string representation of the object
|
254
|
+
# @return [String] String presentation of the object
|
255
|
+
def to_s
|
256
|
+
to_hash.to_s
|
257
|
+
end
|
258
|
+
|
259
|
+
# to_body is an alias to to_hash (backward compatibility)
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
261
|
+
def to_body
|
262
|
+
to_hash
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the object in the form of hash
|
266
|
+
# @return [Hash] Returns the object in the form of hash
|
267
|
+
def to_hash
|
268
|
+
hash = {}
|
269
|
+
self.class.attribute_map.each_pair do |attr, param|
|
270
|
+
value = self.send(attr)
|
271
|
+
if value.nil?
|
272
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
273
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
274
|
+
end
|
275
|
+
|
276
|
+
hash[param] = _to_hash(value)
|
277
|
+
end
|
278
|
+
hash
|
279
|
+
end
|
280
|
+
|
281
|
+
# Outputs non-array value in the form of hash
|
282
|
+
# For object, use to_hash. Otherwise, just return the value
|
283
|
+
# @param [Object] value Any valid value
|
284
|
+
# @return [Hash] Returns the value in the form of hash
|
285
|
+
def _to_hash(value)
|
286
|
+
if value.is_a?(Array)
|
287
|
+
value.compact.map { |v| _to_hash(v) }
|
288
|
+
elsif value.is_a?(Hash)
|
289
|
+
{}.tap do |hash|
|
290
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
291
|
+
end
|
292
|
+
elsif value.respond_to? :to_hash
|
293
|
+
value.to_hash
|
294
|
+
else
|
295
|
+
value
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
@@ -0,0 +1,300 @@
|
|
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
|
+
# Representation of a alias
|
17
|
+
class AliasProjection
|
18
|
+
attr_accessor :created_at
|
19
|
+
|
20
|
+
attr_accessor :email_address
|
21
|
+
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
attr_accessor :inbox_id
|
25
|
+
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
attr_accessor :updated_at
|
29
|
+
|
30
|
+
attr_accessor :use_threads
|
31
|
+
|
32
|
+
attr_accessor :user_id
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'created_at' => :'createdAt',
|
38
|
+
:'email_address' => :'emailAddress',
|
39
|
+
:'id' => :'id',
|
40
|
+
:'inbox_id' => :'inboxId',
|
41
|
+
:'name' => :'name',
|
42
|
+
:'updated_at' => :'updatedAt',
|
43
|
+
:'use_threads' => :'useThreads',
|
44
|
+
:'user_id' => :'userId'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.openapi_types
|
50
|
+
{
|
51
|
+
:'created_at' => :'DateTime',
|
52
|
+
:'email_address' => :'String',
|
53
|
+
:'id' => :'String',
|
54
|
+
:'inbox_id' => :'String',
|
55
|
+
:'name' => :'String',
|
56
|
+
:'updated_at' => :'DateTime',
|
57
|
+
:'use_threads' => :'Boolean',
|
58
|
+
:'user_id' => :'String'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# List of attributes with nullable: true
|
63
|
+
def self.openapi_nullable
|
64
|
+
Set.new([
|
65
|
+
])
|
66
|
+
end
|
67
|
+
|
68
|
+
# Initializes the object
|
69
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
70
|
+
def initialize(attributes = {})
|
71
|
+
if (!attributes.is_a?(Hash))
|
72
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::AliasProjection` initialize method"
|
73
|
+
end
|
74
|
+
|
75
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
77
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
78
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::AliasProjection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
79
|
+
end
|
80
|
+
h[k.to_sym] = v
|
81
|
+
}
|
82
|
+
|
83
|
+
if attributes.key?(:'created_at')
|
84
|
+
self.created_at = attributes[:'created_at']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'email_address')
|
88
|
+
self.email_address = attributes[:'email_address']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'id')
|
92
|
+
self.id = attributes[:'id']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'inbox_id')
|
96
|
+
self.inbox_id = attributes[:'inbox_id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'name')
|
100
|
+
self.name = attributes[:'name']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'updated_at')
|
104
|
+
self.updated_at = attributes[:'updated_at']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'use_threads')
|
108
|
+
self.use_threads = attributes[:'use_threads']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'user_id')
|
112
|
+
self.user_id = attributes[:'user_id']
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
117
|
+
# @return Array for valid properties with the reasons
|
118
|
+
def list_invalid_properties
|
119
|
+
invalid_properties = Array.new
|
120
|
+
if @created_at.nil?
|
121
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
122
|
+
end
|
123
|
+
|
124
|
+
if @email_address.nil?
|
125
|
+
invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
|
126
|
+
end
|
127
|
+
|
128
|
+
if @id.nil?
|
129
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @inbox_id.nil?
|
133
|
+
invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @updated_at.nil?
|
137
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @user_id.nil?
|
141
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
invalid_properties
|
145
|
+
end
|
146
|
+
|
147
|
+
# Check to see if the all the properties in the model are valid
|
148
|
+
# @return true if the model is valid
|
149
|
+
def valid?
|
150
|
+
return false if @created_at.nil?
|
151
|
+
return false if @email_address.nil?
|
152
|
+
return false if @id.nil?
|
153
|
+
return false if @inbox_id.nil?
|
154
|
+
return false if @updated_at.nil?
|
155
|
+
return false if @user_id.nil?
|
156
|
+
true
|
157
|
+
end
|
158
|
+
|
159
|
+
# Checks equality by comparing each attribute.
|
160
|
+
# @param [Object] Object to be compared
|
161
|
+
def ==(o)
|
162
|
+
return true if self.equal?(o)
|
163
|
+
self.class == o.class &&
|
164
|
+
created_at == o.created_at &&
|
165
|
+
email_address == o.email_address &&
|
166
|
+
id == o.id &&
|
167
|
+
inbox_id == o.inbox_id &&
|
168
|
+
name == o.name &&
|
169
|
+
updated_at == o.updated_at &&
|
170
|
+
use_threads == o.use_threads &&
|
171
|
+
user_id == o.user_id
|
172
|
+
end
|
173
|
+
|
174
|
+
# @see the `==` method
|
175
|
+
# @param [Object] Object to be compared
|
176
|
+
def eql?(o)
|
177
|
+
self == o
|
178
|
+
end
|
179
|
+
|
180
|
+
# Calculates hash code according to all attributes.
|
181
|
+
# @return [Integer] Hash code
|
182
|
+
def hash
|
183
|
+
[created_at, email_address, id, inbox_id, name, updated_at, use_threads, user_id].hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Builds the object from hash
|
187
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
188
|
+
# @return [Object] Returns the model itself
|
189
|
+
def self.build_from_hash(attributes)
|
190
|
+
new.build_from_hash(attributes)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Builds the object from hash
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
195
|
+
# @return [Object] Returns the model itself
|
196
|
+
def build_from_hash(attributes)
|
197
|
+
return nil unless attributes.is_a?(Hash)
|
198
|
+
self.class.openapi_types.each_pair do |key, type|
|
199
|
+
if type =~ /\AArray<(.*)>/i
|
200
|
+
# check to ensure the input is an array given that the attribute
|
201
|
+
# is documented as an array but the input is not
|
202
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
203
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
204
|
+
end
|
205
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
206
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
207
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
208
|
+
end
|
209
|
+
|
210
|
+
self
|
211
|
+
end
|
212
|
+
|
213
|
+
# Deserializes the data based on type
|
214
|
+
# @param string type Data type
|
215
|
+
# @param string value Value to be deserialized
|
216
|
+
# @return [Object] Deserialized data
|
217
|
+
def _deserialize(type, value)
|
218
|
+
case type.to_sym
|
219
|
+
when :DateTime
|
220
|
+
DateTime.parse(value)
|
221
|
+
when :Date
|
222
|
+
Date.parse(value)
|
223
|
+
when :String
|
224
|
+
value.to_s
|
225
|
+
when :Integer
|
226
|
+
value.to_i
|
227
|
+
when :Float
|
228
|
+
value.to_f
|
229
|
+
when :Boolean
|
230
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
231
|
+
true
|
232
|
+
else
|
233
|
+
false
|
234
|
+
end
|
235
|
+
when :Object
|
236
|
+
# generic object (usually a Hash), return directly
|
237
|
+
value
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
241
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each do |k, v|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
else # model
|
250
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
256
|
+
def to_s
|
257
|
+
to_hash.to_s
|
258
|
+
end
|
259
|
+
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_body
|
263
|
+
to_hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash
|
269
|
+
hash = {}
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
271
|
+
value = self.send(attr)
|
272
|
+
if value.nil?
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
275
|
+
end
|
276
|
+
|
277
|
+
hash[param] = _to_hash(value)
|
278
|
+
end
|
279
|
+
hash
|
280
|
+
end
|
281
|
+
|
282
|
+
# Outputs non-array value in the form of hash
|
283
|
+
# For object, use to_hash. Otherwise, just return the value
|
284
|
+
# @param [Object] value Any valid value
|
285
|
+
# @return [Hash] Returns the value in the form of hash
|
286
|
+
def _to_hash(value)
|
287
|
+
if value.is_a?(Array)
|
288
|
+
value.compact.map { |v| _to_hash(v) }
|
289
|
+
elsif value.is_a?(Hash)
|
290
|
+
{}.tap do |hash|
|
291
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
292
|
+
end
|
293
|
+
elsif value.respond_to? :to_hash
|
294
|
+
value.to_hash
|
295
|
+
else
|
296
|
+
value
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|