mailslurp_client 15.11.0 → 15.11.1

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