mailslurp_client 15.11.0 → 15.12.1

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