mailslurp_client 8.0.6 → 8.0.12

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 +117 -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,254 @@
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
+ # Name Server Record
17
+ class NameServerRecord
18
+ attr_accessor :priority
19
+
20
+ attr_accessor :raw
21
+
22
+ attr_accessor :record_type
23
+
24
+ attr_accessor :value
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'priority' => :'priority',
30
+ :'raw' => :'raw',
31
+ :'record_type' => :'recordType',
32
+ :'value' => :'value'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'priority' => :'String',
40
+ :'raw' => :'String',
41
+ :'record_type' => :'String',
42
+ :'value' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::NameServerRecord` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::NameServerRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'priority')
68
+ self.priority = attributes[:'priority']
69
+ end
70
+
71
+ if attributes.key?(:'raw')
72
+ self.raw = attributes[:'raw']
73
+ end
74
+
75
+ if attributes.key?(:'record_type')
76
+ self.record_type = attributes[:'record_type']
77
+ end
78
+
79
+ if attributes.key?(:'value')
80
+ self.value = attributes[:'value']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @priority.nil?
89
+ invalid_properties.push('invalid value for "priority", priority cannot be nil.')
90
+ end
91
+
92
+ if @raw.nil?
93
+ invalid_properties.push('invalid value for "raw", raw cannot be nil.')
94
+ end
95
+
96
+ if @record_type.nil?
97
+ invalid_properties.push('invalid value for "record_type", record_type cannot be nil.')
98
+ end
99
+
100
+ if @value.nil?
101
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
102
+ end
103
+
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ return false if @priority.nil?
111
+ return false if @raw.nil?
112
+ return false if @record_type.nil?
113
+ return false if @value.nil?
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ priority == o.priority &&
123
+ raw == o.raw &&
124
+ record_type == o.record_type &&
125
+ value == o.value
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [priority, raw, record_type, value].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ MailSlurpClient.const_get(type).build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,298 @@
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 PageAlias
17
+ attr_accessor :content
18
+
19
+ attr_accessor :empty
20
+
21
+ attr_accessor :first
22
+
23
+ attr_accessor :last
24
+
25
+ attr_accessor :number
26
+
27
+ attr_accessor :number_of_elements
28
+
29
+ attr_accessor :pageable
30
+
31
+ attr_accessor :size
32
+
33
+ attr_accessor :sort
34
+
35
+ attr_accessor :total_elements
36
+
37
+ attr_accessor :total_pages
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'content' => :'content',
43
+ :'empty' => :'empty',
44
+ :'first' => :'first',
45
+ :'last' => :'last',
46
+ :'number' => :'number',
47
+ :'number_of_elements' => :'numberOfElements',
48
+ :'pageable' => :'pageable',
49
+ :'size' => :'size',
50
+ :'sort' => :'sort',
51
+ :'total_elements' => :'totalElements',
52
+ :'total_pages' => :'totalPages'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'content' => :'Array<ModelAlias>',
60
+ :'empty' => :'Boolean',
61
+ :'first' => :'Boolean',
62
+ :'last' => :'Boolean',
63
+ :'number' => :'Integer',
64
+ :'number_of_elements' => :'Integer',
65
+ :'pageable' => :'Pageable',
66
+ :'size' => :'Integer',
67
+ :'sort' => :'Sort',
68
+ :'total_elements' => :'Integer',
69
+ :'total_pages' => :'Integer'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::PageAlias` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::PageAlias`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'content')
95
+ if (value = attributes[:'content']).is_a?(Array)
96
+ self.content = value
97
+ end
98
+ end
99
+
100
+ if attributes.key?(:'empty')
101
+ self.empty = attributes[:'empty']
102
+ end
103
+
104
+ if attributes.key?(:'first')
105
+ self.first = attributes[:'first']
106
+ end
107
+
108
+ if attributes.key?(:'last')
109
+ self.last = attributes[:'last']
110
+ end
111
+
112
+ if attributes.key?(:'number')
113
+ self.number = attributes[:'number']
114
+ end
115
+
116
+ if attributes.key?(:'number_of_elements')
117
+ self.number_of_elements = attributes[:'number_of_elements']
118
+ end
119
+
120
+ if attributes.key?(:'pageable')
121
+ self.pageable = attributes[:'pageable']
122
+ end
123
+
124
+ if attributes.key?(:'size')
125
+ self.size = attributes[:'size']
126
+ end
127
+
128
+ if attributes.key?(:'sort')
129
+ self.sort = attributes[:'sort']
130
+ end
131
+
132
+ if attributes.key?(:'total_elements')
133
+ self.total_elements = attributes[:'total_elements']
134
+ end
135
+
136
+ if attributes.key?(:'total_pages')
137
+ self.total_pages = attributes[:'total_pages']
138
+ end
139
+ end
140
+
141
+ # Show invalid properties with the reasons. Usually used together with valid?
142
+ # @return Array for valid properties with the reasons
143
+ def list_invalid_properties
144
+ invalid_properties = Array.new
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ true
152
+ end
153
+
154
+ # Checks equality by comparing each attribute.
155
+ # @param [Object] Object to be compared
156
+ def ==(o)
157
+ return true if self.equal?(o)
158
+ self.class == o.class &&
159
+ content == o.content &&
160
+ empty == o.empty &&
161
+ first == o.first &&
162
+ last == o.last &&
163
+ number == o.number &&
164
+ number_of_elements == o.number_of_elements &&
165
+ pageable == o.pageable &&
166
+ size == o.size &&
167
+ sort == o.sort &&
168
+ total_elements == o.total_elements &&
169
+ total_pages == o.total_pages
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [content, empty, first, last, number, number_of_elements, pageable, size, sort, total_elements, total_pages].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ new.build_from_hash(attributes)
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ self.class.openapi_types.each_pair do |key, type|
197
+ if type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :DateTime
218
+ DateTime.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ MailSlurpClient.const_get(type).build_from_hash(value)
249
+ end
250
+ end
251
+
252
+ # Returns the string representation of the object
253
+ # @return [String] String presentation of the object
254
+ def to_s
255
+ to_hash.to_s
256
+ end
257
+
258
+ # to_body is an alias to to_hash (backward compatibility)
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_body
261
+ to_hash
262
+ end
263
+
264
+ # Returns the object in the form of hash
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_hash
267
+ hash = {}
268
+ self.class.attribute_map.each_pair do |attr, param|
269
+ value = self.send(attr)
270
+ if value.nil?
271
+ is_nullable = self.class.openapi_nullable.include?(attr)
272
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
273
+ end
274
+
275
+ hash[param] = _to_hash(value)
276
+ end
277
+ hash
278
+ end
279
+
280
+ # Outputs non-array value in the form of hash
281
+ # For object, use to_hash. Otherwise, just return the value
282
+ # @param [Object] value Any valid value
283
+ # @return [Hash] Returns the value in the form of hash
284
+ def _to_hash(value)
285
+ if value.is_a?(Array)
286
+ value.compact.map { |v| _to_hash(v) }
287
+ elsif value.is_a?(Hash)
288
+ {}.tap do |hash|
289
+ value.each { |k, v| hash[k] = _to_hash(v) }
290
+ end
291
+ elsif value.respond_to? :to_hash
292
+ value.to_hash
293
+ else
294
+ value
295
+ end
296
+ end
297
+ end
298
+ end