mailslurp_client 15.9.0 → 15.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/api_user_controller_api.rb +74 -0
  3. data/lib/mailslurp_client/api/attachment_controller_api.rb +4 -4
  4. data/lib/mailslurp_client/api/email_controller_api.rb +68 -3
  5. data/lib/mailslurp_client/api/inbox_controller_api.rb +138 -0
  6. data/lib/mailslurp_client/api/missed_email_controller_api.rb +56 -0
  7. data/lib/mailslurp_client/api/phone_controller_api.rb +487 -0
  8. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +73 -0
  9. data/lib/mailslurp_client/api/sms_controller_api.rb +286 -0
  10. data/lib/mailslurp_client/api/template_controller_api.rb +124 -0
  11. data/lib/mailslurp_client/api/wait_for_controller_api.rb +64 -0
  12. data/lib/mailslurp_client/api/webhook_controller_api.rb +2 -2
  13. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +2 -2
  14. data/lib/mailslurp_client/models/alias_projection.rb +31 -31
  15. data/lib/mailslurp_client/models/attachment_entity.rb +10 -1
  16. data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
  17. data/lib/mailslurp_client/models/bounce_projection.rb +31 -4
  18. data/lib/mailslurp_client/models/{bounce_recipient.rb → bounce_recipient_projection.rb} +35 -36
  19. data/lib/mailslurp_client/models/bounced_email_dto.rb +19 -1
  20. data/lib/mailslurp_client/models/bounced_recipient_dto.rb +37 -1
  21. data/lib/mailslurp_client/models/contact_projection.rb +18 -13
  22. data/lib/mailslurp_client/models/create_emergency_address_options.rb +324 -0
  23. data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
  24. data/lib/mailslurp_client/models/email_html_dto.rb +215 -0
  25. data/lib/mailslurp_client/models/email_preview.rb +5 -0
  26. data/lib/mailslurp_client/models/email_projection.rb +29 -19
  27. data/lib/mailslurp_client/models/emergency_address.rb +408 -0
  28. data/lib/mailslurp_client/models/emergency_address_dto.rb +273 -0
  29. data/lib/mailslurp_client/models/empty_response_dto.rb +206 -0
  30. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  31. data/lib/mailslurp_client/models/inbox_by_name_result.rb +221 -0
  32. data/lib/mailslurp_client/models/inbox_dto.rb +11 -1
  33. data/lib/mailslurp_client/models/inbox_preview.rb +5 -0
  34. data/lib/mailslurp_client/models/missed_email.rb +37 -1
  35. data/lib/mailslurp_client/models/organization_inbox_projection.rb +5 -0
  36. data/lib/mailslurp_client/models/page_alias.rb +22 -22
  37. data/lib/mailslurp_client/models/page_attachment_entity.rb +22 -22
  38. data/lib/mailslurp_client/models/page_bounced_email.rb +22 -22
  39. data/lib/mailslurp_client/models/page_bounced_recipients.rb +23 -23
  40. data/lib/mailslurp_client/models/page_contact_projection.rb +22 -22
  41. data/lib/mailslurp_client/models/page_email_preview.rb +22 -22
  42. data/lib/mailslurp_client/models/page_email_projection.rb +22 -22
  43. data/lib/mailslurp_client/models/page_email_validation_request.rb +22 -22
  44. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +22 -22
  45. data/lib/mailslurp_client/models/page_group_projection.rb +22 -22
  46. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +22 -22
  47. data/lib/mailslurp_client/models/page_inbox_projection.rb +22 -22
  48. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +22 -22
  49. data/lib/mailslurp_client/models/page_missed_email_projection.rb +22 -22
  50. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +22 -22
  51. data/lib/mailslurp_client/models/page_phone_number_projection.rb +308 -0
  52. data/lib/mailslurp_client/models/page_sent_email_projection.rb +16 -16
  53. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +344 -0
  54. data/lib/mailslurp_client/models/page_sms_projection.rb +308 -0
  55. data/lib/mailslurp_client/models/page_template_projection.rb +22 -22
  56. data/lib/mailslurp_client/models/page_thread_projection.rb +22 -22
  57. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +22 -22
  58. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +22 -22
  59. data/lib/mailslurp_client/models/page_webhook_projection.rb +22 -22
  60. data/lib/mailslurp_client/models/page_webhook_result.rb +22 -22
  61. data/lib/mailslurp_client/models/phone_number_dto.rb +347 -0
  62. data/lib/mailslurp_client/models/phone_number_projection.rb +302 -0
  63. data/lib/mailslurp_client/models/phone_plan_dto.rb +287 -0
  64. data/lib/mailslurp_client/models/send_with_queue_result.rb +318 -0
  65. data/lib/mailslurp_client/models/sent_email_projection.rb +18 -13
  66. data/lib/mailslurp_client/models/sms_match_option.rb +289 -0
  67. data/lib/mailslurp_client/models/sms_message.rb +318 -0
  68. data/lib/mailslurp_client/models/sms_preview.rb +267 -0
  69. data/lib/mailslurp_client/models/sms_projection.rb +282 -0
  70. data/lib/mailslurp_client/models/template_preview.rb +211 -0
  71. data/lib/mailslurp_client/models/template_projection.rb +18 -18
  72. data/lib/mailslurp_client/models/thread_projection.rb +36 -36
  73. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +19 -19
  74. data/lib/mailslurp_client/models/user_info_dto.rb +334 -0
  75. data/lib/mailslurp_client/models/wait_for_sms_conditions.rb +371 -0
  76. data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
  77. data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
  78. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  79. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
  80. data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
  81. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  82. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +7 -2
  83. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  84. data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
  85. data/lib/mailslurp_client/models/webhook_result_dto.rb +7 -2
  86. data/lib/mailslurp_client/version.rb +1 -1
  87. data/lib/mailslurp_client.rb +24 -1
  88. metadata +26 -3
@@ -21,18 +21,18 @@ module MailSlurpClient
21
21
 
22
22
  attr_accessor :subject
23
23
 
24
- attr_accessor :inbox_id
25
-
26
24
  attr_accessor :attachments
27
25
 
26
+ attr_accessor :inbox_id
27
+
28
28
  attr_accessor :to
29
29
 
30
+ attr_accessor :created_at
31
+
30
32
  attr_accessor :bcc
31
33
 
32
34
  attr_accessor :cc
33
35
 
34
- attr_accessor :created_at
35
-
36
36
  attr_accessor :team_access
37
37
 
38
38
  attr_accessor :read
@@ -47,12 +47,12 @@ module MailSlurpClient
47
47
  :'id' => :'id',
48
48
  :'from' => :'from',
49
49
  :'subject' => :'subject',
50
- :'inbox_id' => :'inboxId',
51
50
  :'attachments' => :'attachments',
51
+ :'inbox_id' => :'inboxId',
52
52
  :'to' => :'to',
53
+ :'created_at' => :'createdAt',
53
54
  :'bcc' => :'bcc',
54
55
  :'cc' => :'cc',
55
- :'created_at' => :'createdAt',
56
56
  :'team_access' => :'teamAccess',
57
57
  :'read' => :'read',
58
58
  :'body_md5_hash' => :'bodyMD5Hash',
@@ -66,12 +66,12 @@ module MailSlurpClient
66
66
  :'id' => :'String',
67
67
  :'from' => :'String',
68
68
  :'subject' => :'String',
69
- :'inbox_id' => :'String',
70
69
  :'attachments' => :'Array<String>',
70
+ :'inbox_id' => :'String',
71
71
  :'to' => :'Array<String>',
72
+ :'created_at' => :'DateTime',
72
73
  :'bcc' => :'Array<String>',
73
74
  :'cc' => :'Array<String>',
74
- :'created_at' => :'DateTime',
75
75
  :'team_access' => :'Boolean',
76
76
  :'read' => :'Boolean',
77
77
  :'body_md5_hash' => :'String',
@@ -112,22 +112,26 @@ module MailSlurpClient
112
112
  self.subject = attributes[:'subject']
113
113
  end
114
114
 
115
- if attributes.key?(:'inbox_id')
116
- self.inbox_id = attributes[:'inbox_id']
117
- end
118
-
119
115
  if attributes.key?(:'attachments')
120
116
  if (value = attributes[:'attachments']).is_a?(Array)
121
117
  self.attachments = value
122
118
  end
123
119
  end
124
120
 
121
+ if attributes.key?(:'inbox_id')
122
+ self.inbox_id = attributes[:'inbox_id']
123
+ end
124
+
125
125
  if attributes.key?(:'to')
126
126
  if (value = attributes[:'to']).is_a?(Array)
127
127
  self.to = value
128
128
  end
129
129
  end
130
130
 
131
+ if attributes.key?(:'created_at')
132
+ self.created_at = attributes[:'created_at']
133
+ end
134
+
131
135
  if attributes.key?(:'bcc')
132
136
  if (value = attributes[:'bcc']).is_a?(Array)
133
137
  self.bcc = value
@@ -140,10 +144,6 @@ module MailSlurpClient
140
144
  end
141
145
  end
142
146
 
143
- if attributes.key?(:'created_at')
144
- self.created_at = attributes[:'created_at']
145
- end
146
-
147
147
  if attributes.key?(:'team_access')
148
148
  self.team_access = attributes[:'team_access']
149
149
  end
@@ -181,6 +181,14 @@ module MailSlurpClient
181
181
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
182
182
  end
183
183
 
184
+ if @team_access.nil?
185
+ invalid_properties.push('invalid value for "team_access", team_access cannot be nil.')
186
+ end
187
+
188
+ if @read.nil?
189
+ invalid_properties.push('invalid value for "read", read cannot be nil.')
190
+ end
191
+
184
192
  invalid_properties
185
193
  end
186
194
 
@@ -191,6 +199,8 @@ module MailSlurpClient
191
199
  return false if @inbox_id.nil?
192
200
  return false if @to.nil?
193
201
  return false if @created_at.nil?
202
+ return false if @team_access.nil?
203
+ return false if @read.nil?
194
204
  true
195
205
  end
196
206
 
@@ -202,12 +212,12 @@ module MailSlurpClient
202
212
  id == o.id &&
203
213
  from == o.from &&
204
214
  subject == o.subject &&
205
- inbox_id == o.inbox_id &&
206
215
  attachments == o.attachments &&
216
+ inbox_id == o.inbox_id &&
207
217
  to == o.to &&
218
+ created_at == o.created_at &&
208
219
  bcc == o.bcc &&
209
220
  cc == o.cc &&
210
- created_at == o.created_at &&
211
221
  team_access == o.team_access &&
212
222
  read == o.read &&
213
223
  body_md5_hash == o.body_md5_hash &&
@@ -223,7 +233,7 @@ module MailSlurpClient
223
233
  # Calculates hash code according to all attributes.
224
234
  # @return [Integer] Hash code
225
235
  def hash
226
- [id, from, subject, inbox_id, attachments, to, bcc, cc, created_at, team_access, read, body_md5_hash, body_excerpt].hash
236
+ [id, from, subject, attachments, inbox_id, to, created_at, bcc, cc, team_access, read, body_md5_hash, body_excerpt].hash
227
237
  end
228
238
 
229
239
  # Builds the object from hash
@@ -0,0 +1,408 @@
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 EmergencyAddress
17
+ attr_accessor :id
18
+
19
+ attr_accessor :sid
20
+
21
+ attr_accessor :user_id
22
+
23
+ attr_accessor :display_name
24
+
25
+ attr_accessor :customer_name
26
+
27
+ attr_accessor :address1
28
+
29
+ attr_accessor :city
30
+
31
+ attr_accessor :region
32
+
33
+ attr_accessor :postal_code
34
+
35
+ attr_accessor :phone_country
36
+
37
+ attr_accessor :account_sid
38
+
39
+ attr_accessor :created_at
40
+
41
+ attr_accessor :updated_at
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'id' => :'id',
69
+ :'sid' => :'sid',
70
+ :'user_id' => :'userId',
71
+ :'display_name' => :'displayName',
72
+ :'customer_name' => :'customerName',
73
+ :'address1' => :'address1',
74
+ :'city' => :'city',
75
+ :'region' => :'region',
76
+ :'postal_code' => :'postalCode',
77
+ :'phone_country' => :'phoneCountry',
78
+ :'account_sid' => :'accountSid',
79
+ :'created_at' => :'createdAt',
80
+ :'updated_at' => :'updatedAt'
81
+ }
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'id' => :'String',
88
+ :'sid' => :'String',
89
+ :'user_id' => :'String',
90
+ :'display_name' => :'String',
91
+ :'customer_name' => :'String',
92
+ :'address1' => :'String',
93
+ :'city' => :'String',
94
+ :'region' => :'String',
95
+ :'postal_code' => :'String',
96
+ :'phone_country' => :'String',
97
+ :'account_sid' => :'String',
98
+ :'created_at' => :'DateTime',
99
+ :'updated_at' => :'DateTime'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ ])
107
+ end
108
+
109
+ # Initializes the object
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ def initialize(attributes = {})
112
+ if (!attributes.is_a?(Hash))
113
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmergencyAddress` initialize method"
114
+ end
115
+
116
+ # check to see if the attribute exists and convert string to symbol for hash key
117
+ attributes = attributes.each_with_object({}) { |(k, v), h|
118
+ if (!self.class.attribute_map.key?(k.to_sym))
119
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmergencyAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
120
+ end
121
+ h[k.to_sym] = v
122
+ }
123
+
124
+ if attributes.key?(:'id')
125
+ self.id = attributes[:'id']
126
+ end
127
+
128
+ if attributes.key?(:'sid')
129
+ self.sid = attributes[:'sid']
130
+ end
131
+
132
+ if attributes.key?(:'user_id')
133
+ self.user_id = attributes[:'user_id']
134
+ end
135
+
136
+ if attributes.key?(:'display_name')
137
+ self.display_name = attributes[:'display_name']
138
+ end
139
+
140
+ if attributes.key?(:'customer_name')
141
+ self.customer_name = attributes[:'customer_name']
142
+ end
143
+
144
+ if attributes.key?(:'address1')
145
+ self.address1 = attributes[:'address1']
146
+ end
147
+
148
+ if attributes.key?(:'city')
149
+ self.city = attributes[:'city']
150
+ end
151
+
152
+ if attributes.key?(:'region')
153
+ self.region = attributes[:'region']
154
+ end
155
+
156
+ if attributes.key?(:'postal_code')
157
+ self.postal_code = attributes[:'postal_code']
158
+ end
159
+
160
+ if attributes.key?(:'phone_country')
161
+ self.phone_country = attributes[:'phone_country']
162
+ end
163
+
164
+ if attributes.key?(:'account_sid')
165
+ self.account_sid = attributes[:'account_sid']
166
+ end
167
+
168
+ if attributes.key?(:'created_at')
169
+ self.created_at = attributes[:'created_at']
170
+ end
171
+
172
+ if attributes.key?(:'updated_at')
173
+ self.updated_at = attributes[:'updated_at']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+ if @sid.nil?
182
+ invalid_properties.push('invalid value for "sid", sid cannot be nil.')
183
+ end
184
+
185
+ if @user_id.nil?
186
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
187
+ end
188
+
189
+ if @display_name.nil?
190
+ invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
191
+ end
192
+
193
+ if @customer_name.nil?
194
+ invalid_properties.push('invalid value for "customer_name", customer_name cannot be nil.')
195
+ end
196
+
197
+ if @address1.nil?
198
+ invalid_properties.push('invalid value for "address1", address1 cannot be nil.')
199
+ end
200
+
201
+ if @city.nil?
202
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
203
+ end
204
+
205
+ if @region.nil?
206
+ invalid_properties.push('invalid value for "region", region cannot be nil.')
207
+ end
208
+
209
+ if @postal_code.nil?
210
+ invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.')
211
+ end
212
+
213
+ if @phone_country.nil?
214
+ invalid_properties.push('invalid value for "phone_country", phone_country cannot be nil.')
215
+ end
216
+
217
+ if @account_sid.nil?
218
+ invalid_properties.push('invalid value for "account_sid", account_sid cannot be nil.')
219
+ end
220
+
221
+ if @created_at.nil?
222
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
223
+ end
224
+
225
+ if @updated_at.nil?
226
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
227
+ end
228
+
229
+ invalid_properties
230
+ end
231
+
232
+ # Check to see if the all the properties in the model are valid
233
+ # @return true if the model is valid
234
+ def valid?
235
+ return false if @sid.nil?
236
+ return false if @user_id.nil?
237
+ return false if @display_name.nil?
238
+ return false if @customer_name.nil?
239
+ return false if @address1.nil?
240
+ return false if @city.nil?
241
+ return false if @region.nil?
242
+ return false if @postal_code.nil?
243
+ return false if @phone_country.nil?
244
+ phone_country_validator = EnumAttributeValidator.new('String', ["US", "GB"])
245
+ return false unless phone_country_validator.valid?(@phone_country)
246
+ return false if @account_sid.nil?
247
+ return false if @created_at.nil?
248
+ return false if @updated_at.nil?
249
+ true
250
+ end
251
+
252
+ # Custom attribute writer method checking allowed values (enum).
253
+ # @param [Object] phone_country Object to be assigned
254
+ def phone_country=(phone_country)
255
+ validator = EnumAttributeValidator.new('String', ["US", "GB"])
256
+ unless validator.valid?(phone_country)
257
+ fail ArgumentError, "invalid value for \"phone_country\", must be one of #{validator.allowable_values}."
258
+ end
259
+ @phone_country = phone_country
260
+ end
261
+
262
+ # Checks equality by comparing each attribute.
263
+ # @param [Object] Object to be compared
264
+ def ==(o)
265
+ return true if self.equal?(o)
266
+ self.class == o.class &&
267
+ id == o.id &&
268
+ sid == o.sid &&
269
+ user_id == o.user_id &&
270
+ display_name == o.display_name &&
271
+ customer_name == o.customer_name &&
272
+ address1 == o.address1 &&
273
+ city == o.city &&
274
+ region == o.region &&
275
+ postal_code == o.postal_code &&
276
+ phone_country == o.phone_country &&
277
+ account_sid == o.account_sid &&
278
+ created_at == o.created_at &&
279
+ updated_at == o.updated_at
280
+ end
281
+
282
+ # @see the `==` method
283
+ # @param [Object] Object to be compared
284
+ def eql?(o)
285
+ self == o
286
+ end
287
+
288
+ # Calculates hash code according to all attributes.
289
+ # @return [Integer] Hash code
290
+ def hash
291
+ [id, sid, user_id, display_name, customer_name, address1, city, region, postal_code, phone_country, account_sid, created_at, updated_at].hash
292
+ end
293
+
294
+ # Builds the object from hash
295
+ # @param [Hash] attributes Model attributes in the form of hash
296
+ # @return [Object] Returns the model itself
297
+ def self.build_from_hash(attributes)
298
+ new.build_from_hash(attributes)
299
+ end
300
+
301
+ # Builds the object from hash
302
+ # @param [Hash] attributes Model attributes in the form of hash
303
+ # @return [Object] Returns the model itself
304
+ def build_from_hash(attributes)
305
+ return nil unless attributes.is_a?(Hash)
306
+ self.class.openapi_types.each_pair do |key, type|
307
+ if type =~ /\AArray<(.*)>/i
308
+ # check to ensure the input is an array given that the attribute
309
+ # is documented as an array but the input is not
310
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
311
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
312
+ end
313
+ elsif !attributes[self.class.attribute_map[key]].nil?
314
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
315
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
316
+ end
317
+
318
+ self
319
+ end
320
+
321
+ # Deserializes the data based on type
322
+ # @param string type Data type
323
+ # @param string value Value to be deserialized
324
+ # @return [Object] Deserialized data
325
+ def _deserialize(type, value)
326
+ case type.to_sym
327
+ when :DateTime
328
+ DateTime.parse(value)
329
+ when :Date
330
+ Date.parse(value)
331
+ when :String
332
+ value.to_s
333
+ when :Integer
334
+ value.to_i
335
+ when :Float
336
+ value.to_f
337
+ when :Boolean
338
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
339
+ true
340
+ else
341
+ false
342
+ end
343
+ when :Object
344
+ # generic object (usually a Hash), return directly
345
+ value
346
+ when /\AArray<(?<inner_type>.+)>\z/
347
+ inner_type = Regexp.last_match[:inner_type]
348
+ value.map { |v| _deserialize(inner_type, v) }
349
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
350
+ k_type = Regexp.last_match[:k_type]
351
+ v_type = Regexp.last_match[:v_type]
352
+ {}.tap do |hash|
353
+ value.each do |k, v|
354
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
355
+ end
356
+ end
357
+ else # model
358
+ MailSlurpClient.const_get(type).build_from_hash(value)
359
+ end
360
+ end
361
+
362
+ # Returns the string representation of the object
363
+ # @return [String] String presentation of the object
364
+ def to_s
365
+ to_hash.to_s
366
+ end
367
+
368
+ # to_body is an alias to to_hash (backward compatibility)
369
+ # @return [Hash] Returns the object in the form of hash
370
+ def to_body
371
+ to_hash
372
+ end
373
+
374
+ # Returns the object in the form of hash
375
+ # @return [Hash] Returns the object in the form of hash
376
+ def to_hash
377
+ hash = {}
378
+ self.class.attribute_map.each_pair do |attr, param|
379
+ value = self.send(attr)
380
+ if value.nil?
381
+ is_nullable = self.class.openapi_nullable.include?(attr)
382
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
383
+ end
384
+
385
+ hash[param] = _to_hash(value)
386
+ end
387
+ hash
388
+ end
389
+
390
+ # Outputs non-array value in the form of hash
391
+ # For object, use to_hash. Otherwise, just return the value
392
+ # @param [Object] value Any valid value
393
+ # @return [Hash] Returns the value in the form of hash
394
+ def _to_hash(value)
395
+ if value.is_a?(Array)
396
+ value.compact.map { |v| _to_hash(v) }
397
+ elsif value.is_a?(Hash)
398
+ {}.tap do |hash|
399
+ value.each { |k, v| hash[k] = _to_hash(v) }
400
+ end
401
+ elsif value.respond_to? :to_hash
402
+ value.to_hash
403
+ else
404
+ value
405
+ end
406
+ end
407
+ end
408
+ end