mailslurp_client 15.17.6 → 15.17.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/lib/mailslurp_client/api/connector_controller_api.rb +619 -0
  4. data/lib/mailslurp_client/models/bounce_projection.rb +15 -15
  5. data/lib/mailslurp_client/models/connector_dto.rb +407 -0
  6. data/lib/mailslurp_client/models/connector_projection.rb +346 -0
  7. data/lib/mailslurp_client/models/connector_sync_event_dto.rb +310 -0
  8. data/lib/mailslurp_client/models/connector_sync_event_projection.rb +306 -0
  9. data/lib/mailslurp_client/models/connector_sync_request_result.rb +224 -0
  10. data/lib/mailslurp_client/models/connector_sync_request_result_exception.rb +246 -0
  11. data/lib/mailslurp_client/models/connector_sync_request_result_exception_cause.rb +237 -0
  12. data/lib/mailslurp_client/models/connector_sync_request_result_exception_cause_stack_trace.rb +269 -0
  13. data/lib/mailslurp_client/models/connector_sync_request_result_exception_cause_suppressed.rb +226 -0
  14. data/lib/mailslurp_client/models/connector_sync_result.rb +222 -0
  15. data/lib/mailslurp_client/models/create_connector_imap_options.rb +267 -0
  16. data/lib/mailslurp_client/models/create_connector_options.rb +338 -0
  17. data/lib/mailslurp_client/models/email_projection.rb +10 -10
  18. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +13 -13
  19. data/lib/mailslurp_client/models/inbox_ruleset_dto.rb +1 -0
  20. data/lib/mailslurp_client/models/missed_email_projection.rb +11 -11
  21. data/lib/mailslurp_client/models/page_connector.rb +308 -0
  22. data/lib/mailslurp_client/models/page_connector_sync_events.rb +308 -0
  23. data/lib/mailslurp_client/models/thread_projection.rb +11 -11
  24. data/lib/mailslurp_client/version.rb +1 -1
  25. data/lib/mailslurp_client.rb +15 -0
  26. metadata +17 -2
@@ -0,0 +1,346 @@
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://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
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
+ # Connector
17
+ class ConnectorProjection
18
+ attr_accessor :id
19
+
20
+ attr_accessor :inbox_id
21
+
22
+ attr_accessor :user_id
23
+
24
+ attr_accessor :created_at
25
+
26
+ attr_accessor :sync_enabled
27
+
28
+ attr_accessor :connector_type
29
+
30
+ attr_accessor :sync_schedule_type
31
+
32
+ attr_accessor :sync_interval
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'id' => :'id',
60
+ :'inbox_id' => :'inboxId',
61
+ :'user_id' => :'userId',
62
+ :'created_at' => :'createdAt',
63
+ :'sync_enabled' => :'syncEnabled',
64
+ :'connector_type' => :'connectorType',
65
+ :'sync_schedule_type' => :'syncScheduleType',
66
+ :'sync_interval' => :'syncInterval'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'id' => :'String',
74
+ :'inbox_id' => :'String',
75
+ :'user_id' => :'String',
76
+ :'created_at' => :'DateTime',
77
+ :'sync_enabled' => :'Boolean',
78
+ :'connector_type' => :'String',
79
+ :'sync_schedule_type' => :'String',
80
+ :'sync_interval' => :'Integer'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ConnectorProjection` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ConnectorProjection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'id')
106
+ self.id = attributes[:'id']
107
+ end
108
+
109
+ if attributes.key?(:'inbox_id')
110
+ self.inbox_id = attributes[:'inbox_id']
111
+ end
112
+
113
+ if attributes.key?(:'user_id')
114
+ self.user_id = attributes[:'user_id']
115
+ end
116
+
117
+ if attributes.key?(:'created_at')
118
+ self.created_at = attributes[:'created_at']
119
+ end
120
+
121
+ if attributes.key?(:'sync_enabled')
122
+ self.sync_enabled = attributes[:'sync_enabled']
123
+ end
124
+
125
+ if attributes.key?(:'connector_type')
126
+ self.connector_type = attributes[:'connector_type']
127
+ end
128
+
129
+ if attributes.key?(:'sync_schedule_type')
130
+ self.sync_schedule_type = attributes[:'sync_schedule_type']
131
+ end
132
+
133
+ if attributes.key?(:'sync_interval')
134
+ self.sync_interval = attributes[:'sync_interval']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ invalid_properties = Array.new
142
+ if @inbox_id.nil?
143
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
144
+ end
145
+
146
+ if @user_id.nil?
147
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
148
+ end
149
+
150
+ if @created_at.nil?
151
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
152
+ end
153
+
154
+ if @sync_enabled.nil?
155
+ invalid_properties.push('invalid value for "sync_enabled", sync_enabled cannot be nil.')
156
+ end
157
+
158
+ if @connector_type.nil?
159
+ invalid_properties.push('invalid value for "connector_type", connector_type cannot be nil.')
160
+ end
161
+
162
+ if @sync_schedule_type.nil?
163
+ invalid_properties.push('invalid value for "sync_schedule_type", sync_schedule_type cannot be nil.')
164
+ end
165
+
166
+ invalid_properties
167
+ end
168
+
169
+ # Check to see if the all the properties in the model are valid
170
+ # @return true if the model is valid
171
+ def valid?
172
+ return false if @inbox_id.nil?
173
+ return false if @user_id.nil?
174
+ return false if @created_at.nil?
175
+ return false if @sync_enabled.nil?
176
+ return false if @connector_type.nil?
177
+ connector_type_validator = EnumAttributeValidator.new('String', ["IMAP"])
178
+ return false unless connector_type_validator.valid?(@connector_type)
179
+ return false if @sync_schedule_type.nil?
180
+ sync_schedule_type_validator = EnumAttributeValidator.new('String', ["INTERVAL"])
181
+ return false unless sync_schedule_type_validator.valid?(@sync_schedule_type)
182
+ true
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] connector_type Object to be assigned
187
+ def connector_type=(connector_type)
188
+ validator = EnumAttributeValidator.new('String', ["IMAP"])
189
+ unless validator.valid?(connector_type)
190
+ fail ArgumentError, "invalid value for \"connector_type\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @connector_type = connector_type
193
+ end
194
+
195
+ # Custom attribute writer method checking allowed values (enum).
196
+ # @param [Object] sync_schedule_type Object to be assigned
197
+ def sync_schedule_type=(sync_schedule_type)
198
+ validator = EnumAttributeValidator.new('String', ["INTERVAL"])
199
+ unless validator.valid?(sync_schedule_type)
200
+ fail ArgumentError, "invalid value for \"sync_schedule_type\", must be one of #{validator.allowable_values}."
201
+ end
202
+ @sync_schedule_type = sync_schedule_type
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ id == o.id &&
211
+ inbox_id == o.inbox_id &&
212
+ user_id == o.user_id &&
213
+ created_at == o.created_at &&
214
+ sync_enabled == o.sync_enabled &&
215
+ connector_type == o.connector_type &&
216
+ sync_schedule_type == o.sync_schedule_type &&
217
+ sync_interval == o.sync_interval
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [id, inbox_id, user_id, created_at, sync_enabled, connector_type, sync_schedule_type, sync_interval].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ new.build_from_hash(attributes)
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def build_from_hash(attributes)
243
+ return nil unless attributes.is_a?(Hash)
244
+ self.class.openapi_types.each_pair do |key, type|
245
+ if type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the attribute
247
+ # is documented as an array but the input is not
248
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
249
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
250
+ end
251
+ elsif !attributes[self.class.attribute_map[key]].nil?
252
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
253
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
254
+ end
255
+
256
+ self
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def _deserialize(type, value)
264
+ case type.to_sym
265
+ when :DateTime
266
+ DateTime.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ MailSlurpClient.const_get(type).build_from_hash(value)
297
+ end
298
+ end
299
+
300
+ # Returns the string representation of the object
301
+ # @return [String] String presentation of the object
302
+ def to_s
303
+ to_hash.to_s
304
+ end
305
+
306
+ # to_body is an alias to to_hash (backward compatibility)
307
+ # @return [Hash] Returns the object in the form of hash
308
+ def to_body
309
+ to_hash
310
+ end
311
+
312
+ # Returns the object in the form of hash
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_hash
315
+ hash = {}
316
+ self.class.attribute_map.each_pair do |attr, param|
317
+ value = self.send(attr)
318
+ if value.nil?
319
+ is_nullable = self.class.openapi_nullable.include?(attr)
320
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
321
+ end
322
+
323
+ hash[param] = _to_hash(value)
324
+ end
325
+ hash
326
+ end
327
+
328
+ # Outputs non-array value in the form of hash
329
+ # For object, use to_hash. Otherwise, just return the value
330
+ # @param [Object] value Any valid value
331
+ # @return [Hash] Returns the value in the form of hash
332
+ def _to_hash(value)
333
+ if value.is_a?(Array)
334
+ value.compact.map { |v| _to_hash(v) }
335
+ elsif value.is_a?(Hash)
336
+ {}.tap do |hash|
337
+ value.each { |k, v| hash[k] = _to_hash(v) }
338
+ end
339
+ elsif value.respond_to? :to_hash
340
+ value.to_hash
341
+ else
342
+ value
343
+ end
344
+ end
345
+ end
346
+ end
@@ -0,0 +1,310 @@
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://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
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 ConnectorSyncEventDto
17
+ attr_accessor :id
18
+
19
+ attr_accessor :connector_id
20
+
21
+ attr_accessor :sync_status
22
+
23
+ attr_accessor :sync_count
24
+
25
+ attr_accessor :message
26
+
27
+ attr_accessor :created_at
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'id' => :'id',
55
+ :'connector_id' => :'connectorId',
56
+ :'sync_status' => :'syncStatus',
57
+ :'sync_count' => :'syncCount',
58
+ :'message' => :'message',
59
+ :'created_at' => :'createdAt'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'id' => :'String',
67
+ :'connector_id' => :'String',
68
+ :'sync_status' => :'String',
69
+ :'sync_count' => :'Integer',
70
+ :'message' => :'String',
71
+ :'created_at' => :'DateTime'
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::ConnectorSyncEventDto` 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::ConnectorSyncEventDto`. 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?(:'id')
97
+ self.id = attributes[:'id']
98
+ end
99
+
100
+ if attributes.key?(:'connector_id')
101
+ self.connector_id = attributes[:'connector_id']
102
+ end
103
+
104
+ if attributes.key?(:'sync_status')
105
+ self.sync_status = attributes[:'sync_status']
106
+ end
107
+
108
+ if attributes.key?(:'sync_count')
109
+ self.sync_count = attributes[:'sync_count']
110
+ end
111
+
112
+ if attributes.key?(:'message')
113
+ self.message = attributes[:'message']
114
+ end
115
+
116
+ if attributes.key?(:'created_at')
117
+ self.created_at = attributes[:'created_at']
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if @id.nil?
126
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
127
+ end
128
+
129
+ if @connector_id.nil?
130
+ invalid_properties.push('invalid value for "connector_id", connector_id cannot be nil.')
131
+ end
132
+
133
+ if @sync_status.nil?
134
+ invalid_properties.push('invalid value for "sync_status", sync_status cannot be nil.')
135
+ end
136
+
137
+ if @sync_count.nil?
138
+ invalid_properties.push('invalid value for "sync_count", sync_count cannot be nil.')
139
+ end
140
+
141
+ if @created_at.nil?
142
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
143
+ end
144
+
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
+ return false if @id.nil?
152
+ return false if @connector_id.nil?
153
+ return false if @sync_status.nil?
154
+ sync_status_validator = EnumAttributeValidator.new('String', ["SUCCESS", "INTERNAL_ERROR", "SUBSCRIPTION_ERROR", "CONNECTION_ERROR", "NOT_FOUND"])
155
+ return false unless sync_status_validator.valid?(@sync_status)
156
+ return false if @sync_count.nil?
157
+ return false if @created_at.nil?
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] sync_status Object to be assigned
163
+ def sync_status=(sync_status)
164
+ validator = EnumAttributeValidator.new('String', ["SUCCESS", "INTERNAL_ERROR", "SUBSCRIPTION_ERROR", "CONNECTION_ERROR", "NOT_FOUND"])
165
+ unless validator.valid?(sync_status)
166
+ fail ArgumentError, "invalid value for \"sync_status\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @sync_status = sync_status
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ id == o.id &&
177
+ connector_id == o.connector_id &&
178
+ sync_status == o.sync_status &&
179
+ sync_count == o.sync_count &&
180
+ message == o.message &&
181
+ created_at == o.created_at
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [id, connector_id, sync_status, sync_count, message, created_at].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ end
219
+
220
+ self
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def _deserialize(type, value)
228
+ case type.to_sym
229
+ when :DateTime
230
+ DateTime.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ MailSlurpClient.const_get(type).build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+ end
310
+ end