mailslurp_client 8.0.10 → 8.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +7 -0
  3. data/README.md +123 -0
  4. data/SECURITY.md +4 -0
  5. data/SUPPORT.md +4 -0
  6. data/lib/mailslurp_client/api/alias_controller_api.rb +405 -0
  7. data/lib/mailslurp_client/api/attachment_controller_api.rb +160 -0
  8. data/lib/mailslurp_client/api/bulk_actions_controller_api.rb +203 -0
  9. data/lib/mailslurp_client/api/common_actions_controller_api.rb +257 -0
  10. data/lib/mailslurp_client/api/contact_controller_api.rb +323 -0
  11. data/lib/mailslurp_client/api/domain_controller_api.rb +264 -0
  12. data/lib/mailslurp_client/api/email_controller_api.rb +852 -0
  13. data/lib/mailslurp_client/api/form_controller_api.rb +104 -0
  14. data/lib/mailslurp_client/api/group_controller_api.rb +592 -0
  15. data/lib/mailslurp_client/api/inbox_controller_api.rb +897 -0
  16. data/lib/mailslurp_client/api/mail_server_controller_api.rb +146 -0
  17. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +152 -0
  18. data/lib/mailslurp_client/api/template_controller_api.rb +323 -0
  19. data/lib/mailslurp_client/api/wait_for_controller_api.rb +359 -0
  20. data/lib/mailslurp_client/api/webhook_controller_api.rb +405 -0
  21. data/lib/mailslurp_client/api_client.rb +388 -0
  22. data/lib/mailslurp_client/api_error.rb +57 -0
  23. data/lib/mailslurp_client/configuration.rb +248 -0
  24. data/lib/mailslurp_client/models/attachment_meta_data.rb +238 -0
  25. data/lib/mailslurp_client/models/basic_auth_options.rb +226 -0
  26. data/lib/mailslurp_client/models/bulk_send_email_options.rb +219 -0
  27. data/lib/mailslurp_client/models/contact_dto.rb +311 -0
  28. data/lib/mailslurp_client/models/contact_projection.rb +270 -0
  29. data/lib/mailslurp_client/models/create_anonymous_alias_options.rb +208 -0
  30. data/lib/mailslurp_client/models/create_contact_options.rb +277 -0
  31. data/lib/mailslurp_client/models/create_domain_options.rb +208 -0
  32. data/lib/mailslurp_client/models/create_group_options.rb +220 -0
  33. data/lib/mailslurp_client/models/create_owned_alias_options.rb +238 -0
  34. data/lib/mailslurp_client/models/create_template_options.rb +225 -0
  35. data/lib/mailslurp_client/models/create_webhook_options.rb +227 -0
  36. data/lib/mailslurp_client/models/describe_domain_options.rb +211 -0
  37. data/lib/mailslurp_client/models/describe_mail_server_domain_result.rb +237 -0
  38. data/lib/mailslurp_client/models/domain_dto.rb +296 -0
  39. data/lib/mailslurp_client/models/domain_preview.rb +240 -0
  40. data/lib/mailslurp_client/models/email.rb +386 -0
  41. data/lib/mailslurp_client/models/email_analysis.rb +248 -0
  42. data/lib/mailslurp_client/models/email_preview.rb +296 -0
  43. data/lib/mailslurp_client/models/email_projection.rb +325 -0
  44. data/lib/mailslurp_client/models/email_verification_result.rb +263 -0
  45. data/lib/mailslurp_client/models/forward_email_options.rb +244 -0
  46. data/lib/mailslurp_client/models/group_contacts_dto.rb +227 -0
  47. data/lib/mailslurp_client/models/group_dto.rb +248 -0
  48. data/lib/mailslurp_client/models/group_projection.rb +248 -0
  49. data/lib/mailslurp_client/models/html_validation_result.rb +244 -0
  50. data/lib/mailslurp_client/models/inbox.rb +290 -0
  51. data/lib/mailslurp_client/models/inbox_projection.rb +263 -0
  52. data/lib/mailslurp_client/models/match_option.rb +274 -0
  53. data/lib/mailslurp_client/models/match_options.rb +210 -0
  54. data/lib/mailslurp_client/models/model_alias.rb +284 -0
  55. data/lib/mailslurp_client/models/name_server_record.rb +254 -0
  56. data/lib/mailslurp_client/models/page_alias.rb +298 -0
  57. data/lib/mailslurp_client/models/page_contact_projection.rb +298 -0
  58. data/lib/mailslurp_client/models/page_email_preview.rb +298 -0
  59. data/lib/mailslurp_client/models/page_email_projection.rb +298 -0
  60. data/lib/mailslurp_client/models/page_group_projection.rb +298 -0
  61. data/lib/mailslurp_client/models/page_inbox_projection.rb +298 -0
  62. data/lib/mailslurp_client/models/page_sent_email_projection.rb +298 -0
  63. data/lib/mailslurp_client/models/page_template_projection.rb +298 -0
  64. data/lib/mailslurp_client/models/page_webhook_projection.rb +298 -0
  65. data/lib/mailslurp_client/models/pageable.rb +251 -0
  66. data/lib/mailslurp_client/models/raw_email_json.rb +211 -0
  67. data/lib/mailslurp_client/models/send_email_options.rb +392 -0
  68. data/lib/mailslurp_client/models/sent_email_dto.rb +351 -0
  69. data/lib/mailslurp_client/models/sent_email_projection.rb +344 -0
  70. data/lib/mailslurp_client/models/set_inbox_favourited_options.rb +208 -0
  71. data/lib/mailslurp_client/models/simple_send_email_options.rb +237 -0
  72. data/lib/mailslurp_client/models/sort.rb +224 -0
  73. data/lib/mailslurp_client/models/template_dto.rb +269 -0
  74. data/lib/mailslurp_client/models/template_projection.rb +269 -0
  75. data/lib/mailslurp_client/models/template_variable.rb +259 -0
  76. data/lib/mailslurp_client/models/unread_count.rb +211 -0
  77. data/lib/mailslurp_client/models/update_group_contacts.rb +213 -0
  78. data/lib/mailslurp_client/models/update_inbox_options.rb +250 -0
  79. data/lib/mailslurp_client/models/upload_attachment_options.rb +228 -0
  80. data/lib/mailslurp_client/models/validation_dto.rb +217 -0
  81. data/lib/mailslurp_client/models/validation_message.rb +220 -0
  82. data/lib/mailslurp_client/models/verify_email_address_options.rb +239 -0
  83. data/lib/mailslurp_client/models/wait_for_conditions.rb +316 -0
  84. data/lib/mailslurp_client/models/webhook_dto.rb +326 -0
  85. data/lib/mailslurp_client/models/webhook_projection.rb +277 -0
  86. data/lib/mailslurp_client/models/webhook_test_request.rb +284 -0
  87. data/lib/mailslurp_client/models/webhook_test_response.rb +215 -0
  88. data/lib/mailslurp_client/models/webhook_test_result.rb +235 -0
  89. data/lib/mailslurp_client/version.rb +15 -0
  90. metadata +90 -2
@@ -0,0 +1,244 @@
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
+ # HTML Validation Results
17
+ class HTMLValidationResult
18
+ attr_accessor :errors
19
+
20
+ attr_accessor :is_valid
21
+
22
+ attr_accessor :warnings
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'errors' => :'errors',
28
+ :'is_valid' => :'isValid',
29
+ :'warnings' => :'warnings'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'errors' => :'Array<ValidationMessage>',
37
+ :'is_valid' => :'Boolean',
38
+ :'warnings' => :'Array<ValidationMessage>'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::HTMLValidationResult` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::HTMLValidationResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'errors')
64
+ if (value = attributes[:'errors']).is_a?(Array)
65
+ self.errors = value
66
+ end
67
+ end
68
+
69
+ if attributes.key?(:'is_valid')
70
+ self.is_valid = attributes[:'is_valid']
71
+ end
72
+
73
+ if attributes.key?(:'warnings')
74
+ if (value = attributes[:'warnings']).is_a?(Array)
75
+ self.warnings = value
76
+ end
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ if @errors.nil?
85
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
86
+ end
87
+
88
+ if @is_valid.nil?
89
+ invalid_properties.push('invalid value for "is_valid", is_valid cannot be nil.')
90
+ end
91
+
92
+ if @warnings.nil?
93
+ invalid_properties.push('invalid value for "warnings", warnings cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return false if @errors.nil?
103
+ return false if @is_valid.nil?
104
+ return false if @warnings.nil?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ errors == o.errors &&
114
+ is_valid == o.is_valid &&
115
+ warnings == o.warnings
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [errors, is_valid, warnings].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ new.build_from_hash(attributes)
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :DateTime
164
+ DateTime.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ MailSlurpClient.const_get(type).build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end
@@ -0,0 +1,290 @@
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 an inbox with an email address. Emails can be sent to or from this email address.
17
+ class Inbox
18
+ # When was the inbox created
19
+ attr_accessor :created_at
20
+
21
+ # Optional description of an inbox for labelling purposes
22
+ attr_accessor :description
23
+
24
+ # The inbox's email address. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints.
25
+ attr_accessor :email_address
26
+
27
+ # 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.
28
+ attr_accessor :expires_at
29
+
30
+ # Is the inbox favourited
31
+ attr_accessor :favourite
32
+
33
+ # ID of the inbox
34
+ attr_accessor :id
35
+
36
+ # Optional name of the inbox. Displayed in the dashboard for easier search
37
+ attr_accessor :name
38
+
39
+ # Tags that inbox has been tagged with
40
+ attr_accessor :tags
41
+
42
+ # ID of user that inbox belongs to
43
+ attr_accessor :user_id
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'created_at' => :'createdAt',
49
+ :'description' => :'description',
50
+ :'email_address' => :'emailAddress',
51
+ :'expires_at' => :'expiresAt',
52
+ :'favourite' => :'favourite',
53
+ :'id' => :'id',
54
+ :'name' => :'name',
55
+ :'tags' => :'tags',
56
+ :'user_id' => :'userId'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'created_at' => :'DateTime',
64
+ :'description' => :'String',
65
+ :'email_address' => :'String',
66
+ :'expires_at' => :'String',
67
+ :'favourite' => :'Boolean',
68
+ :'id' => :'String',
69
+ :'name' => :'String',
70
+ :'tags' => :'Array<String>',
71
+ :'user_id' => :'String'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::Inbox` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::Inbox`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'created_at')
97
+ self.created_at = attributes[:'created_at']
98
+ end
99
+
100
+ if attributes.key?(:'description')
101
+ self.description = attributes[:'description']
102
+ end
103
+
104
+ if attributes.key?(:'email_address')
105
+ self.email_address = attributes[:'email_address']
106
+ end
107
+
108
+ if attributes.key?(:'expires_at')
109
+ self.expires_at = attributes[:'expires_at']
110
+ end
111
+
112
+ if attributes.key?(:'favourite')
113
+ self.favourite = attributes[:'favourite']
114
+ end
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ end
119
+
120
+ if attributes.key?(:'name')
121
+ self.name = attributes[:'name']
122
+ end
123
+
124
+ if attributes.key?(:'tags')
125
+ if (value = attributes[:'tags']).is_a?(Array)
126
+ self.tags = value
127
+ end
128
+ end
129
+
130
+ if attributes.key?(:'user_id')
131
+ self.user_id = attributes[:'user_id']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ invalid_properties = Array.new
139
+ invalid_properties
140
+ end
141
+
142
+ # Check to see if the all the properties in the model are valid
143
+ # @return true if the model is valid
144
+ def valid?
145
+ true
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ created_at == o.created_at &&
154
+ description == o.description &&
155
+ email_address == o.email_address &&
156
+ expires_at == o.expires_at &&
157
+ favourite == o.favourite &&
158
+ id == o.id &&
159
+ name == o.name &&
160
+ tags == o.tags &&
161
+ user_id == o.user_id
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [created_at, description, email_address, expires_at, favourite, id, name, tags, user_id].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ new.build_from_hash(attributes)
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def build_from_hash(attributes)
187
+ return nil unless attributes.is_a?(Hash)
188
+ self.class.openapi_types.each_pair do |key, type|
189
+ if type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
193
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
198
+ end
199
+
200
+ self
201
+ end
202
+
203
+ # Deserializes the data based on type
204
+ # @param string type Data type
205
+ # @param string value Value to be deserialized
206
+ # @return [Object] Deserialized data
207
+ def _deserialize(type, value)
208
+ case type.to_sym
209
+ when :DateTime
210
+ DateTime.parse(value)
211
+ when :Date
212
+ Date.parse(value)
213
+ when :String
214
+ value.to_s
215
+ when :Integer
216
+ value.to_i
217
+ when :Float
218
+ value.to_f
219
+ when :Boolean
220
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
+ true
222
+ else
223
+ false
224
+ end
225
+ when :Object
226
+ # generic object (usually a Hash), return directly
227
+ value
228
+ when /\AArray<(?<inner_type>.+)>\z/
229
+ inner_type = Regexp.last_match[:inner_type]
230
+ value.map { |v| _deserialize(inner_type, v) }
231
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
+ k_type = Regexp.last_match[:k_type]
233
+ v_type = Regexp.last_match[:v_type]
234
+ {}.tap do |hash|
235
+ value.each do |k, v|
236
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
+ end
238
+ end
239
+ else # model
240
+ MailSlurpClient.const_get(type).build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+ end
290
+ end