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,334 @@
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 UserInfoDto
17
+ attr_accessor :id
18
+
19
+ attr_accessor :email_address
20
+
21
+ attr_accessor :account_state
22
+
23
+ attr_accessor :subscription_type
24
+
25
+ attr_accessor :account_type
26
+
27
+ attr_accessor :created_at
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'id' => :'id',
55
+ :'email_address' => :'emailAddress',
56
+ :'account_state' => :'accountState',
57
+ :'subscription_type' => :'subscriptionType',
58
+ :'account_type' => :'accountType',
59
+ :'created_at' => :'createdAt'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'id' => :'String',
67
+ :'email_address' => :'String',
68
+ :'account_state' => :'String',
69
+ :'subscription_type' => :'String',
70
+ :'account_type' => :'String',
71
+ :'created_at' => :'DateTime'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::UserInfoDto` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::UserInfoDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'id')
97
+ self.id = attributes[:'id']
98
+ end
99
+
100
+ if attributes.key?(:'email_address')
101
+ self.email_address = attributes[:'email_address']
102
+ end
103
+
104
+ if attributes.key?(:'account_state')
105
+ self.account_state = attributes[:'account_state']
106
+ end
107
+
108
+ if attributes.key?(:'subscription_type')
109
+ self.subscription_type = attributes[:'subscription_type']
110
+ end
111
+
112
+ if attributes.key?(:'account_type')
113
+ self.account_type = attributes[:'account_type']
114
+ end
115
+
116
+ if attributes.key?(:'created_at')
117
+ self.created_at = attributes[:'created_at']
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if @id.nil?
126
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
127
+ end
128
+
129
+ if @email_address.nil?
130
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
131
+ end
132
+
133
+ if @account_state.nil?
134
+ invalid_properties.push('invalid value for "account_state", account_state cannot be nil.')
135
+ end
136
+
137
+ if @account_type.nil?
138
+ invalid_properties.push('invalid value for "account_type", account_type cannot be nil.')
139
+ end
140
+
141
+ if @created_at.nil?
142
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ return false if @id.nil?
152
+ return false if @email_address.nil?
153
+ return false if @account_state.nil?
154
+ account_state_validator = EnumAttributeValidator.new('String', ["FROZEN", "ACTIVE"])
155
+ return false unless account_state_validator.valid?(@account_state)
156
+ subscription_type_validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "TEAM", "ENTERPRISE"])
157
+ return false unless subscription_type_validator.valid?(@subscription_type)
158
+ return false if @account_type.nil?
159
+ account_type_validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM"])
160
+ return false unless account_type_validator.valid?(@account_type)
161
+ return false if @created_at.nil?
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] account_state Object to be assigned
167
+ def account_state=(account_state)
168
+ validator = EnumAttributeValidator.new('String', ["FROZEN", "ACTIVE"])
169
+ unless validator.valid?(account_state)
170
+ fail ArgumentError, "invalid value for \"account_state\", must be one of #{validator.allowable_values}."
171
+ end
172
+ @account_state = account_state
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] subscription_type Object to be assigned
177
+ def subscription_type=(subscription_type)
178
+ validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "TEAM", "ENTERPRISE"])
179
+ unless validator.valid?(subscription_type)
180
+ fail ArgumentError, "invalid value for \"subscription_type\", must be one of #{validator.allowable_values}."
181
+ end
182
+ @subscription_type = subscription_type
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] account_type Object to be assigned
187
+ def account_type=(account_type)
188
+ validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM"])
189
+ unless validator.valid?(account_type)
190
+ fail ArgumentError, "invalid value for \"account_type\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @account_type = account_type
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ id == o.id &&
201
+ email_address == o.email_address &&
202
+ account_state == o.account_state &&
203
+ subscription_type == o.subscription_type &&
204
+ account_type == o.account_type &&
205
+ created_at == o.created_at
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Integer] Hash code
216
+ def hash
217
+ [id, email_address, account_state, subscription_type, account_type, created_at].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def self.build_from_hash(attributes)
224
+ new.build_from_hash(attributes)
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ self.class.openapi_types.each_pair do |key, type|
233
+ if type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
237
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
238
+ end
239
+ elsif !attributes[self.class.attribute_map[key]].nil?
240
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
241
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def _deserialize(type, value)
252
+ case type.to_sym
253
+ when :DateTime
254
+ DateTime.parse(value)
255
+ when :Date
256
+ Date.parse(value)
257
+ when :String
258
+ value.to_s
259
+ when :Integer
260
+ value.to_i
261
+ when :Float
262
+ value.to_f
263
+ when :Boolean
264
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
265
+ true
266
+ else
267
+ false
268
+ end
269
+ when :Object
270
+ # generic object (usually a Hash), return directly
271
+ value
272
+ when /\AArray<(?<inner_type>.+)>\z/
273
+ inner_type = Regexp.last_match[:inner_type]
274
+ value.map { |v| _deserialize(inner_type, v) }
275
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
276
+ k_type = Regexp.last_match[:k_type]
277
+ v_type = Regexp.last_match[:v_type]
278
+ {}.tap do |hash|
279
+ value.each do |k, v|
280
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
281
+ end
282
+ end
283
+ else # model
284
+ MailSlurpClient.const_get(type).build_from_hash(value)
285
+ end
286
+ end
287
+
288
+ # Returns the string representation of the object
289
+ # @return [String] String presentation of the object
290
+ def to_s
291
+ to_hash.to_s
292
+ end
293
+
294
+ # to_body is an alias to to_hash (backward compatibility)
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_body
297
+ to_hash
298
+ end
299
+
300
+ # Returns the object in the form of hash
301
+ # @return [Hash] Returns the object in the form of hash
302
+ def to_hash
303
+ hash = {}
304
+ self.class.attribute_map.each_pair do |attr, param|
305
+ value = self.send(attr)
306
+ if value.nil?
307
+ is_nullable = self.class.openapi_nullable.include?(attr)
308
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
309
+ end
310
+
311
+ hash[param] = _to_hash(value)
312
+ end
313
+ hash
314
+ end
315
+
316
+ # Outputs non-array value in the form of hash
317
+ # For object, use to_hash. Otherwise, just return the value
318
+ # @param [Object] value Any valid value
319
+ # @return [Hash] Returns the value in the form of hash
320
+ def _to_hash(value)
321
+ if value.is_a?(Array)
322
+ value.compact.map { |v| _to_hash(v) }
323
+ elsif value.is_a?(Hash)
324
+ {}.tap do |hash|
325
+ value.each { |k, v| hash[k] = _to_hash(v) }
326
+ end
327
+ elsif value.respond_to? :to_hash
328
+ value.to_hash
329
+ else
330
+ value
331
+ end
332
+ end
333
+ end
334
+ end
@@ -0,0 +1,371 @@
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
+ # Conditions to apply to emails that you are waiting for
17
+ class WaitForSmsConditions
18
+ # ID of phone number to search within and apply conditions to. Essentially filtering the SMS found to give a count.
19
+ attr_accessor :phone_number_id
20
+
21
+ # Limit results
22
+ attr_accessor :limit
23
+
24
+ # Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation.
25
+ attr_accessor :count
26
+
27
+ # Max time in milliseconds to wait between retries if a `timeout` is specified.
28
+ attr_accessor :delay_timeout
29
+
30
+ # Max time in milliseconds to retry the `waitFor` operation until conditions are met.
31
+ attr_accessor :timeout
32
+
33
+ # Apply conditions only to **unread** SMS. All SMS messages begin with `read=false`. An SMS is marked `read=true` when an `SMS` has been returned to the user at least once. For example you have called `getSms` or `waitForSms` etc., or you have viewed the SMS in the dashboard.
34
+ attr_accessor :unread_only
35
+
36
+ # How result size should be compared with the expected size. Exactly or at-least matching result?
37
+ attr_accessor :count_type
38
+
39
+ # Conditions that should be matched for an SMS to qualify for results. Each condition will be applied in order to each SMS within a phone number to filter a result list of matching SMSs you are waiting for.
40
+ attr_accessor :matches
41
+
42
+ # Direction to sort matching SMSs by created time
43
+ attr_accessor :sort_direction
44
+
45
+ # ISO Date Time earliest time of SMS to consider. Filter for matching SMSs that were received after this date
46
+ attr_accessor :since
47
+
48
+ # ISO Date Time latest time of SMS to consider. Filter for matching SMSs that were received before this date
49
+ attr_accessor :before
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'phone_number_id' => :'phoneNumberId',
77
+ :'limit' => :'limit',
78
+ :'count' => :'count',
79
+ :'delay_timeout' => :'delayTimeout',
80
+ :'timeout' => :'timeout',
81
+ :'unread_only' => :'unreadOnly',
82
+ :'count_type' => :'countType',
83
+ :'matches' => :'matches',
84
+ :'sort_direction' => :'sortDirection',
85
+ :'since' => :'since',
86
+ :'before' => :'before'
87
+ }
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.openapi_types
92
+ {
93
+ :'phone_number_id' => :'String',
94
+ :'limit' => :'Integer',
95
+ :'count' => :'Integer',
96
+ :'delay_timeout' => :'Integer',
97
+ :'timeout' => :'Integer',
98
+ :'unread_only' => :'Boolean',
99
+ :'count_type' => :'String',
100
+ :'matches' => :'Array<SmsMatchOption>',
101
+ :'sort_direction' => :'String',
102
+ :'since' => :'DateTime',
103
+ :'before' => :'DateTime'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ ])
111
+ end
112
+
113
+ # Initializes the object
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ def initialize(attributes = {})
116
+ if (!attributes.is_a?(Hash))
117
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WaitForSmsConditions` initialize method"
118
+ end
119
+
120
+ # check to see if the attribute exists and convert string to symbol for hash key
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!self.class.attribute_map.key?(k.to_sym))
123
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WaitForSmsConditions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:'phone_number_id')
129
+ self.phone_number_id = attributes[:'phone_number_id']
130
+ end
131
+
132
+ if attributes.key?(:'limit')
133
+ self.limit = attributes[:'limit']
134
+ end
135
+
136
+ if attributes.key?(:'count')
137
+ self.count = attributes[:'count']
138
+ end
139
+
140
+ if attributes.key?(:'delay_timeout')
141
+ self.delay_timeout = attributes[:'delay_timeout']
142
+ end
143
+
144
+ if attributes.key?(:'timeout')
145
+ self.timeout = attributes[:'timeout']
146
+ end
147
+
148
+ if attributes.key?(:'unread_only')
149
+ self.unread_only = attributes[:'unread_only']
150
+ end
151
+
152
+ if attributes.key?(:'count_type')
153
+ self.count_type = attributes[:'count_type']
154
+ end
155
+
156
+ if attributes.key?(:'matches')
157
+ if (value = attributes[:'matches']).is_a?(Array)
158
+ self.matches = value
159
+ end
160
+ end
161
+
162
+ if attributes.key?(:'sort_direction')
163
+ self.sort_direction = attributes[:'sort_direction']
164
+ end
165
+
166
+ if attributes.key?(:'since')
167
+ self.since = attributes[:'since']
168
+ end
169
+
170
+ if attributes.key?(:'before')
171
+ self.before = attributes[:'before']
172
+ end
173
+ end
174
+
175
+ # Show invalid properties with the reasons. Usually used together with valid?
176
+ # @return Array for valid properties with the reasons
177
+ def list_invalid_properties
178
+ invalid_properties = Array.new
179
+ if @phone_number_id.nil?
180
+ invalid_properties.push('invalid value for "phone_number_id", phone_number_id cannot be nil.')
181
+ end
182
+
183
+ if @count.nil?
184
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
185
+ end
186
+
187
+ if @timeout.nil?
188
+ invalid_properties.push('invalid value for "timeout", timeout cannot be nil.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ return false if @phone_number_id.nil?
198
+ return false if @count.nil?
199
+ return false if @timeout.nil?
200
+ count_type_validator = EnumAttributeValidator.new('String', ["EXACTLY", "ATLEAST"])
201
+ return false unless count_type_validator.valid?(@count_type)
202
+ sort_direction_validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
203
+ return false unless sort_direction_validator.valid?(@sort_direction)
204
+ true
205
+ end
206
+
207
+ # Custom attribute writer method checking allowed values (enum).
208
+ # @param [Object] count_type Object to be assigned
209
+ def count_type=(count_type)
210
+ validator = EnumAttributeValidator.new('String', ["EXACTLY", "ATLEAST"])
211
+ unless validator.valid?(count_type)
212
+ fail ArgumentError, "invalid value for \"count_type\", must be one of #{validator.allowable_values}."
213
+ end
214
+ @count_type = count_type
215
+ end
216
+
217
+ # Custom attribute writer method checking allowed values (enum).
218
+ # @param [Object] sort_direction Object to be assigned
219
+ def sort_direction=(sort_direction)
220
+ validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
221
+ unless validator.valid?(sort_direction)
222
+ fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{validator.allowable_values}."
223
+ end
224
+ @sort_direction = sort_direction
225
+ end
226
+
227
+ # Checks equality by comparing each attribute.
228
+ # @param [Object] Object to be compared
229
+ def ==(o)
230
+ return true if self.equal?(o)
231
+ self.class == o.class &&
232
+ phone_number_id == o.phone_number_id &&
233
+ limit == o.limit &&
234
+ count == o.count &&
235
+ delay_timeout == o.delay_timeout &&
236
+ timeout == o.timeout &&
237
+ unread_only == o.unread_only &&
238
+ count_type == o.count_type &&
239
+ matches == o.matches &&
240
+ sort_direction == o.sort_direction &&
241
+ since == o.since &&
242
+ before == o.before
243
+ end
244
+
245
+ # @see the `==` method
246
+ # @param [Object] Object to be compared
247
+ def eql?(o)
248
+ self == o
249
+ end
250
+
251
+ # Calculates hash code according to all attributes.
252
+ # @return [Integer] Hash code
253
+ def hash
254
+ [phone_number_id, limit, count, delay_timeout, timeout, unread_only, count_type, matches, sort_direction, since, before].hash
255
+ end
256
+
257
+ # Builds the object from hash
258
+ # @param [Hash] attributes Model attributes in the form of hash
259
+ # @return [Object] Returns the model itself
260
+ def self.build_from_hash(attributes)
261
+ new.build_from_hash(attributes)
262
+ end
263
+
264
+ # Builds the object from hash
265
+ # @param [Hash] attributes Model attributes in the form of hash
266
+ # @return [Object] Returns the model itself
267
+ def build_from_hash(attributes)
268
+ return nil unless attributes.is_a?(Hash)
269
+ self.class.openapi_types.each_pair do |key, type|
270
+ if type =~ /\AArray<(.*)>/i
271
+ # check to ensure the input is an array given that the attribute
272
+ # is documented as an array but the input is not
273
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
274
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
275
+ end
276
+ elsif !attributes[self.class.attribute_map[key]].nil?
277
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
278
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
279
+ end
280
+
281
+ self
282
+ end
283
+
284
+ # Deserializes the data based on type
285
+ # @param string type Data type
286
+ # @param string value Value to be deserialized
287
+ # @return [Object] Deserialized data
288
+ def _deserialize(type, value)
289
+ case type.to_sym
290
+ when :DateTime
291
+ DateTime.parse(value)
292
+ when :Date
293
+ Date.parse(value)
294
+ when :String
295
+ value.to_s
296
+ when :Integer
297
+ value.to_i
298
+ when :Float
299
+ value.to_f
300
+ when :Boolean
301
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
302
+ true
303
+ else
304
+ false
305
+ end
306
+ when :Object
307
+ # generic object (usually a Hash), return directly
308
+ value
309
+ when /\AArray<(?<inner_type>.+)>\z/
310
+ inner_type = Regexp.last_match[:inner_type]
311
+ value.map { |v| _deserialize(inner_type, v) }
312
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
313
+ k_type = Regexp.last_match[:k_type]
314
+ v_type = Regexp.last_match[:v_type]
315
+ {}.tap do |hash|
316
+ value.each do |k, v|
317
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
318
+ end
319
+ end
320
+ else # model
321
+ MailSlurpClient.const_get(type).build_from_hash(value)
322
+ end
323
+ end
324
+
325
+ # Returns the string representation of the object
326
+ # @return [String] String presentation of the object
327
+ def to_s
328
+ to_hash.to_s
329
+ end
330
+
331
+ # to_body is an alias to to_hash (backward compatibility)
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_body
334
+ to_hash
335
+ end
336
+
337
+ # Returns the object in the form of hash
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_hash
340
+ hash = {}
341
+ self.class.attribute_map.each_pair do |attr, param|
342
+ value = self.send(attr)
343
+ if value.nil?
344
+ is_nullable = self.class.openapi_nullable.include?(attr)
345
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
346
+ end
347
+
348
+ hash[param] = _to_hash(value)
349
+ end
350
+ hash
351
+ end
352
+
353
+ # Outputs non-array value in the form of hash
354
+ # For object, use to_hash. Otherwise, just return the value
355
+ # @param [Object] value Any valid value
356
+ # @return [Hash] Returns the value in the form of hash
357
+ def _to_hash(value)
358
+ if value.is_a?(Array)
359
+ value.compact.map { |v| _to_hash(v) }
360
+ elsif value.is_a?(Hash)
361
+ {}.tap do |hash|
362
+ value.each { |k, v| hash[k] = _to_hash(v) }
363
+ end
364
+ elsif value.respond_to? :to_hash
365
+ value.to_hash
366
+ else
367
+ value
368
+ end
369
+ end
370
+ end
371
+ end