mailslurp_client 8.2.16 → 8.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -2
  3. data/lib/mailslurp_client.rb +10 -2
  4. data/lib/mailslurp_client/api/alias_controller_api.rb +34 -96
  5. data/lib/mailslurp_client/api/domain_controller_api.rb +7 -5
  6. data/lib/mailslurp_client/api/email_controller_api.rb +72 -2
  7. data/lib/mailslurp_client/api/form_controller_api.rb +4 -7
  8. data/lib/mailslurp_client/api/inbox_controller_api.rb +87 -10
  9. data/lib/mailslurp_client/api/mail_server_controller_api.rb +123 -0
  10. data/lib/mailslurp_client/models/alias_dto.rb +276 -0
  11. data/lib/mailslurp_client/models/alias_projection.rb +276 -0
  12. data/lib/mailslurp_client/models/{create_owned_alias_options.rb → create_alias_options.rb} +13 -13
  13. data/lib/mailslurp_client/models/create_inbox_dto.rb +259 -0
  14. data/lib/mailslurp_client/models/dns_lookup_options.rb +252 -0
  15. data/lib/mailslurp_client/models/dns_lookup_result.rb +288 -0
  16. data/lib/mailslurp_client/models/dns_lookup_results.rb +214 -0
  17. data/lib/mailslurp_client/models/domain_dto.rb +16 -16
  18. data/lib/mailslurp_client/models/email.rb +11 -1
  19. data/lib/mailslurp_client/models/html_validation_result.rb +3 -15
  20. data/lib/mailslurp_client/models/inbox.rb +5 -5
  21. data/lib/mailslurp_client/models/ip_address_result.rb +226 -0
  22. data/lib/mailslurp_client/models/model_alias.rb +36 -22
  23. data/lib/mailslurp_client/models/page_alias.rb +1 -1
  24. data/lib/mailslurp_client/models/reply_to_email_options.rb +313 -0
  25. data/lib/mailslurp_client/models/{create_anonymous_alias_options.rb → update_alias_options.rb} +12 -12
  26. data/lib/mailslurp_client/models/update_inbox_options.rb +2 -2
  27. data/lib/mailslurp_client/version.rb +1 -1
  28. metadata +12 -4
@@ -0,0 +1,276 @@
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 :id
19
+
20
+ attr_accessor :inbox_id
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :pending_email_address
25
+
26
+ attr_accessor :use_threads
27
+
28
+ attr_accessor :user_id
29
+
30
+ attr_accessor :verified_email_address
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'id' => :'id',
36
+ :'inbox_id' => :'inboxId',
37
+ :'name' => :'name',
38
+ :'pending_email_address' => :'pendingEmailAddress',
39
+ :'use_threads' => :'useThreads',
40
+ :'user_id' => :'userId',
41
+ :'verified_email_address' => :'verifiedEmailAddress'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'id' => :'String',
49
+ :'inbox_id' => :'String',
50
+ :'name' => :'String',
51
+ :'pending_email_address' => :'String',
52
+ :'use_threads' => :'Boolean',
53
+ :'user_id' => :'String',
54
+ :'verified_email_address' => :'String'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::AliasProjection` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ 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
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'id')
80
+ self.id = attributes[:'id']
81
+ end
82
+
83
+ if attributes.key?(:'inbox_id')
84
+ self.inbox_id = attributes[:'inbox_id']
85
+ end
86
+
87
+ if attributes.key?(:'name')
88
+ self.name = attributes[:'name']
89
+ end
90
+
91
+ if attributes.key?(:'pending_email_address')
92
+ self.pending_email_address = attributes[:'pending_email_address']
93
+ end
94
+
95
+ if attributes.key?(:'use_threads')
96
+ self.use_threads = attributes[:'use_threads']
97
+ end
98
+
99
+ if attributes.key?(:'user_id')
100
+ self.user_id = attributes[:'user_id']
101
+ end
102
+
103
+ if attributes.key?(:'verified_email_address')
104
+ self.verified_email_address = attributes[:'verified_email_address']
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ invalid_properties = Array.new
112
+ if @id.nil?
113
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
114
+ end
115
+
116
+ if @inbox_id.nil?
117
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
118
+ end
119
+
120
+ if @user_id.nil?
121
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ return false if @id.nil?
131
+ return false if @inbox_id.nil?
132
+ return false if @user_id.nil?
133
+ true
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ id == o.id &&
142
+ inbox_id == o.inbox_id &&
143
+ name == o.name &&
144
+ pending_email_address == o.pending_email_address &&
145
+ use_threads == o.use_threads &&
146
+ user_id == o.user_id &&
147
+ verified_email_address == o.verified_email_address
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [id, inbox_id, name, pending_email_address, use_threads, user_id, verified_email_address].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ new.build_from_hash(attributes)
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ MailSlurpClient.const_get(type).build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end
@@ -14,18 +14,18 @@ require 'date'
14
14
 
15
15
  module MailSlurpClient
16
16
  # Create email alias options. Email aliases can be used to mask real email addresses behind an ID. You can also attach an inbox to an alias so that any email received by the inbox email address if forwarded to the alias email address.
17
- class CreateOwnedAliasOptions
18
- # Email address to be hidden behind alias
17
+ class CreateAliasOptions
18
+ # Email address to be hidden behind alias. Emails sent to the alias email address will be forwarded to this address. If you want to enable replies set useThreads true and the reply-to for the email will allow outbound communication via a thread.
19
19
  attr_accessor :email_address
20
20
 
21
- # Optional inbox ID to attach to alias. Emails received by this inbox will be forwarded to the alias email address
21
+ # Optional inbox ID to attach to alias. Null by default means an a new inbox will be created for the alias. Use a custom inbox to control what email address the alias uses. To use custom email addresses create a domain and an inbox, the use the inbox ID with this call. Emails received by this inbox will be forwarded to the alias email address
22
22
  attr_accessor :inbox_id
23
23
 
24
24
  # Optional name for alias
25
25
  attr_accessor :name
26
26
 
27
- # Optional proxied flag. When proxied is true alias will forward the incoming emails to the aliased email address via a proxy inbox. A new proxy is created for every new email thread. By replying to the proxy you can correspond with using your email alias without revealing your real email address.
28
- attr_accessor :proxied
27
+ # Enable threads options. If true emails will be sent with a unique reply-to thread address. This means you can reply to the forwarded email and it will be sent to the recipients via your alias address. That way a thread conversation is preserved.
28
+ attr_accessor :use_threads
29
29
 
30
30
  # Attribute mapping from ruby-style variable name to JSON key.
31
31
  def self.attribute_map
@@ -33,7 +33,7 @@ module MailSlurpClient
33
33
  :'email_address' => :'emailAddress',
34
34
  :'inbox_id' => :'inboxId',
35
35
  :'name' => :'name',
36
- :'proxied' => :'proxied'
36
+ :'use_threads' => :'useThreads'
37
37
  }
38
38
  end
39
39
 
@@ -43,7 +43,7 @@ module MailSlurpClient
43
43
  :'email_address' => :'String',
44
44
  :'inbox_id' => :'String',
45
45
  :'name' => :'String',
46
- :'proxied' => :'Boolean'
46
+ :'use_threads' => :'Boolean'
47
47
  }
48
48
  end
49
49
 
@@ -57,13 +57,13 @@ module MailSlurpClient
57
57
  # @param [Hash] attributes Model attributes in the form of hash
58
58
  def initialize(attributes = {})
59
59
  if (!attributes.is_a?(Hash))
60
- fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateOwnedAliasOptions` initialize method"
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateAliasOptions` initialize method"
61
61
  end
62
62
 
63
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
64
  attributes = attributes.each_with_object({}) { |(k, v), h|
65
65
  if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateOwnedAliasOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateAliasOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
67
  end
68
68
  h[k.to_sym] = v
69
69
  }
@@ -80,8 +80,8 @@ module MailSlurpClient
80
80
  self.name = attributes[:'name']
81
81
  end
82
82
 
83
- if attributes.key?(:'proxied')
84
- self.proxied = attributes[:'proxied']
83
+ if attributes.key?(:'use_threads')
84
+ self.use_threads = attributes[:'use_threads']
85
85
  end
86
86
  end
87
87
 
@@ -106,7 +106,7 @@ module MailSlurpClient
106
106
  email_address == o.email_address &&
107
107
  inbox_id == o.inbox_id &&
108
108
  name == o.name &&
109
- proxied == o.proxied
109
+ use_threads == o.use_threads
110
110
  end
111
111
 
112
112
  # @see the `==` method
@@ -118,7 +118,7 @@ module MailSlurpClient
118
118
  # Calculates hash code according to all attributes.
119
119
  # @return [Integer] Hash code
120
120
  def hash
121
- [email_address, inbox_id, name, proxied].hash
121
+ [email_address, inbox_id, name, use_threads].hash
122
122
  end
123
123
 
124
124
  # Builds the object from hash
@@ -0,0 +1,259 @@
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
+ class CreateInboxDto
17
+ # Optional description of an inbox for labelling purposes
18
+ attr_accessor :description
19
+
20
+ # Optionally specify an email address you want the inbox to have. When left blank an email address will be randomly assigned to the inbox usually ending in `@mailslurp.com`. Custom email addresses must include your own custom domain that you have configured in MailSlurp. So if your domain is `mysite.com` you can created any email address ending in `@mysite.com`. All email addresses are transformed to lowercase!
21
+ attr_accessor :email_address
22
+
23
+ # When, if ever, will the inbox expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. Timestamp passed as string.
24
+ attr_accessor :expires_at
25
+
26
+ # Is the inbox favorited. Favouriting inboxes is typically done in the dashboard for quick access
27
+ attr_accessor :favourite
28
+
29
+ # Optional name of the inbox. Displayed in the dashboard for easier search
30
+ attr_accessor :name
31
+
32
+ # Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
33
+ attr_accessor :tags
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'description' => :'description',
39
+ :'email_address' => :'emailAddress',
40
+ :'expires_at' => :'expiresAt',
41
+ :'favourite' => :'favourite',
42
+ :'name' => :'name',
43
+ :'tags' => :'tags'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'description' => :'String',
51
+ :'email_address' => :'String',
52
+ :'expires_at' => :'DateTime',
53
+ :'favourite' => :'Boolean',
54
+ :'name' => :'String',
55
+ :'tags' => :'Array<String>'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateInboxDto` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateInboxDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'description')
81
+ self.description = attributes[:'description']
82
+ end
83
+
84
+ if attributes.key?(:'email_address')
85
+ self.email_address = attributes[:'email_address']
86
+ end
87
+
88
+ if attributes.key?(:'expires_at')
89
+ self.expires_at = attributes[:'expires_at']
90
+ end
91
+
92
+ if attributes.key?(:'favourite')
93
+ self.favourite = attributes[:'favourite']
94
+ end
95
+
96
+ if attributes.key?(:'name')
97
+ self.name = attributes[:'name']
98
+ end
99
+
100
+ if attributes.key?(:'tags')
101
+ if (value = attributes[:'tags']).is_a?(Array)
102
+ self.tags = value
103
+ end
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ description == o.description &&
126
+ email_address == o.email_address &&
127
+ expires_at == o.expires_at &&
128
+ favourite == o.favourite &&
129
+ name == o.name &&
130
+ tags == o.tags
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [description, email_address, expires_at, favourite, name, tags].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ MailSlurpClient.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end