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