mailslurp_client 16.2.1 → 16.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/ai_controller_api.rb +193 -79
  3. data/lib/mailslurp_client/api/attachment_controller_api.rb +6 -3
  4. data/lib/mailslurp_client/api/email_controller_api.rb +3 -0
  5. data/lib/mailslurp_client/api/form_controller_api.rb +8 -9
  6. data/lib/mailslurp_client/api/inbox_controller_api.rb +28 -2
  7. data/lib/mailslurp_client/api/mfa_controller_api.rb +73 -9
  8. data/lib/mailslurp_client/api/sms_controller_api.rb +3 -0
  9. data/lib/mailslurp_client/api/webhook_controller_api.rb +63 -9
  10. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +2 -2
  11. data/lib/mailslurp_client/models/{ai_tranform_create_options.rb → ai_transform_create_options.rb} +31 -7
  12. data/lib/mailslurp_client/models/ai_transform_dto.rb +1 -0
  13. data/lib/mailslurp_client/models/ai_transform_mapping_dto.rb +18 -9
  14. data/lib/mailslurp_client/models/ai_transform_mapping_projection.rb +15 -6
  15. data/lib/mailslurp_client/models/ai_transform_projection.rb +16 -1
  16. data/lib/mailslurp_client/models/ai_transform_result_dto.rb +5 -1
  17. data/lib/mailslurp_client/models/{ai_transform_result_projection.rb → ai_transform_result_projection_dto.rb} +56 -53
  18. data/lib/mailslurp_client/models/conditional_structured_content_result.rb +221 -0
  19. data/lib/mailslurp_client/models/create_ai_transformer_mapping_options.rb +5 -10
  20. data/lib/mailslurp_client/models/create_domain_options.rb +19 -0
  21. data/lib/mailslurp_client/models/create_inbox_forwarder_options.rb +19 -0
  22. data/lib/mailslurp_client/models/create_inbox_replier_options.rb +19 -0
  23. data/lib/mailslurp_client/models/create_inbox_ruleset_options.rb +2 -2
  24. data/lib/mailslurp_client/models/create_totp_device_base32_secret_key_options.rb +306 -0
  25. data/lib/mailslurp_client/models/create_totp_device_custom_options.rb +306 -0
  26. data/lib/mailslurp_client/models/create_totp_device_otp_auth_url_options.rb +35 -0
  27. data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
  28. data/lib/mailslurp_client/models/describe_domain_options.rb +19 -0
  29. data/lib/mailslurp_client/models/dns_lookup_options.rb +19 -0
  30. data/lib/mailslurp_client/models/email_projection.rb +11 -11
  31. data/lib/mailslurp_client/models/email_thread_projection.rb +10 -10
  32. data/lib/mailslurp_client/models/entity_automation_item_projection.rb +10 -10
  33. data/lib/mailslurp_client/models/expiration_defaults.rb +1 -0
  34. data/lib/mailslurp_client/models/fake_email_dto.rb +1 -0
  35. data/lib/mailslurp_client/models/generate_structured_content_attachment_options.rb +1 -0
  36. data/lib/mailslurp_client/models/generate_structured_content_email_options.rb +1 -0
  37. data/lib/mailslurp_client/models/generate_structured_content_sms_options.rb +1 -0
  38. data/lib/mailslurp_client/models/inbox_exists_dto.rb +26 -4
  39. data/lib/mailslurp_client/models/inbox_ruleset_dto.rb +2 -2
  40. data/lib/mailslurp_client/models/inline_object.rb +58 -12
  41. data/lib/mailslurp_client/models/inline_object1.rb +211 -0
  42. data/lib/mailslurp_client/models/invoke_transformer_options.rb +329 -0
  43. data/lib/mailslurp_client/models/match_option.rb +19 -0
  44. data/lib/mailslurp_client/models/missed_email_dto.rb +1 -0
  45. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +1 -1
  46. data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +19 -19
  47. data/lib/mailslurp_client/models/phone_message_thread_projection.rb +0 -10
  48. data/lib/mailslurp_client/models/sent_email_projection.rb +15 -30
  49. data/lib/mailslurp_client/models/sms_match_option.rb +19 -0
  50. data/lib/mailslurp_client/models/sms_preview.rb +4 -0
  51. data/lib/mailslurp_client/models/structured_output_schema.rb +12 -9
  52. data/lib/mailslurp_client/models/update_inbox_replier_options.rb +19 -0
  53. data/lib/mailslurp_client/models/upload_attachment_options.rb +19 -0
  54. data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
  55. data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
  56. data/lib/mailslurp_client/models/webhook_delivery_status_payload.rb +2 -2
  57. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  58. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
  59. data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
  60. data/lib/mailslurp_client/models/webhook_new_ai_transform_result_payload.rb +389 -0
  61. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  62. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
  63. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  64. data/lib/mailslurp_client/models/webhook_new_sms_payload.rb +2 -2
  65. data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
  66. data/lib/mailslurp_client/models/webhook_result_dto.rb +2 -2
  67. data/lib/mailslurp_client/version.rb +1 -1
  68. data/lib/mailslurp_client.rb +8 -2
  69. metadata +10 -4
@@ -0,0 +1,306 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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 CreateTotpDeviceBase32SecretKeyOptions
17
+ # Base32 secret key for TOTP device as alternative to OTP Auth URI or QR code.
18
+ attr_accessor :base32_secret_key
19
+
20
+ # Name for labeling the TOTP device
21
+ attr_accessor :name
22
+
23
+ # Optional username for the TOTP device
24
+ attr_accessor :username
25
+
26
+ # Optional issuer override for the TOTP device
27
+ attr_accessor :issuer
28
+
29
+ # Optional number of digits in TOTP code
30
+ attr_accessor :digits
31
+
32
+ # Optional period in seconds for TOTP code expiration
33
+ attr_accessor :period
34
+
35
+ # Optional algorithm override
36
+ attr_accessor :algorithm
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'base32_secret_key' => :'base32SecretKey',
42
+ :'name' => :'name',
43
+ :'username' => :'username',
44
+ :'issuer' => :'issuer',
45
+ :'digits' => :'digits',
46
+ :'period' => :'period',
47
+ :'algorithm' => :'algorithm'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'base32_secret_key' => :'String',
55
+ :'name' => :'String',
56
+ :'username' => :'String',
57
+ :'issuer' => :'String',
58
+ :'digits' => :'Integer',
59
+ :'period' => :'Integer',
60
+ :'algorithm' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'name',
68
+ :'username',
69
+ :'issuer',
70
+ :'digits',
71
+ :'period',
72
+ :'algorithm'
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::CreateTotpDeviceBase32SecretKeyOptions` 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::CreateTotpDeviceBase32SecretKeyOptions`. 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?(:'base32_secret_key')
92
+ self.base32_secret_key = attributes[:'base32_secret_key']
93
+ end
94
+
95
+ if attributes.key?(:'name')
96
+ self.name = attributes[:'name']
97
+ end
98
+
99
+ if attributes.key?(:'username')
100
+ self.username = attributes[:'username']
101
+ end
102
+
103
+ if attributes.key?(:'issuer')
104
+ self.issuer = attributes[:'issuer']
105
+ end
106
+
107
+ if attributes.key?(:'digits')
108
+ self.digits = attributes[:'digits']
109
+ else
110
+ self.digits = 6
111
+ end
112
+
113
+ if attributes.key?(:'period')
114
+ self.period = attributes[:'period']
115
+ else
116
+ self.period = 30
117
+ end
118
+
119
+ if attributes.key?(:'algorithm')
120
+ self.algorithm = attributes[:'algorithm']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ if @base32_secret_key.nil?
129
+ invalid_properties.push('invalid value for "base32_secret_key", base32_secret_key cannot be nil.')
130
+ end
131
+
132
+ if !@digits.nil? && @digits > 255
133
+ invalid_properties.push('invalid value for "digits", must be smaller than or equal to 255.')
134
+ end
135
+
136
+ if !@digits.nil? && @digits < 0
137
+ invalid_properties.push('invalid value for "digits", must be greater than or equal to 0.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if @base32_secret_key.nil?
147
+ return false if !@digits.nil? && @digits > 255
148
+ return false if !@digits.nil? && @digits < 0
149
+ true
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] digits Value to be assigned
154
+ def digits=(digits)
155
+ if !digits.nil? && digits > 255
156
+ fail ArgumentError, 'invalid value for "digits", must be smaller than or equal to 255.'
157
+ end
158
+
159
+ if !digits.nil? && digits < 0
160
+ fail ArgumentError, 'invalid value for "digits", must be greater than or equal to 0.'
161
+ end
162
+
163
+ @digits = digits
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ base32_secret_key == o.base32_secret_key &&
172
+ name == o.name &&
173
+ username == o.username &&
174
+ issuer == o.issuer &&
175
+ digits == o.digits &&
176
+ period == o.period &&
177
+ algorithm == o.algorithm
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Integer] Hash code
188
+ def hash
189
+ [base32_secret_key, name, username, issuer, digits, period, algorithm].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ new.build_from_hash(attributes)
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ self.class.openapi_types.each_pair do |key, type|
205
+ if type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
209
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
213
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ MailSlurpClient.const_get(type).build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map { |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+ end
306
+ end
@@ -0,0 +1,306 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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 CreateTotpDeviceCustomOptions
17
+ # The base32 encoded secret provided by the identity provider for the TOTP device.
18
+ attr_accessor :secret
19
+
20
+ # Name for labeling the TOTP device
21
+ attr_accessor :name
22
+
23
+ # Optional username for the TOTP device
24
+ attr_accessor :username
25
+
26
+ # Optional issuer override for the TOTP device
27
+ attr_accessor :issuer
28
+
29
+ # Optional number of digits in TOTP code
30
+ attr_accessor :digits
31
+
32
+ # Optional period in seconds for TOTP code expiration
33
+ attr_accessor :period
34
+
35
+ # Optional algorithm override
36
+ attr_accessor :algorithm
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'secret' => :'secret',
42
+ :'name' => :'name',
43
+ :'username' => :'username',
44
+ :'issuer' => :'issuer',
45
+ :'digits' => :'digits',
46
+ :'period' => :'period',
47
+ :'algorithm' => :'algorithm'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'secret' => :'String',
55
+ :'name' => :'String',
56
+ :'username' => :'String',
57
+ :'issuer' => :'String',
58
+ :'digits' => :'Integer',
59
+ :'period' => :'Integer',
60
+ :'algorithm' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'name',
68
+ :'username',
69
+ :'issuer',
70
+ :'digits',
71
+ :'period',
72
+ :'algorithm'
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::CreateTotpDeviceCustomOptions` 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::CreateTotpDeviceCustomOptions`. 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?(:'secret')
92
+ self.secret = attributes[:'secret']
93
+ end
94
+
95
+ if attributes.key?(:'name')
96
+ self.name = attributes[:'name']
97
+ end
98
+
99
+ if attributes.key?(:'username')
100
+ self.username = attributes[:'username']
101
+ end
102
+
103
+ if attributes.key?(:'issuer')
104
+ self.issuer = attributes[:'issuer']
105
+ end
106
+
107
+ if attributes.key?(:'digits')
108
+ self.digits = attributes[:'digits']
109
+ else
110
+ self.digits = 6
111
+ end
112
+
113
+ if attributes.key?(:'period')
114
+ self.period = attributes[:'period']
115
+ else
116
+ self.period = 30
117
+ end
118
+
119
+ if attributes.key?(:'algorithm')
120
+ self.algorithm = attributes[:'algorithm']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ if @secret.nil?
129
+ invalid_properties.push('invalid value for "secret", secret cannot be nil.')
130
+ end
131
+
132
+ if !@digits.nil? && @digits > 255
133
+ invalid_properties.push('invalid value for "digits", must be smaller than or equal to 255.')
134
+ end
135
+
136
+ if !@digits.nil? && @digits < 0
137
+ invalid_properties.push('invalid value for "digits", must be greater than or equal to 0.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if @secret.nil?
147
+ return false if !@digits.nil? && @digits > 255
148
+ return false if !@digits.nil? && @digits < 0
149
+ true
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] digits Value to be assigned
154
+ def digits=(digits)
155
+ if !digits.nil? && digits > 255
156
+ fail ArgumentError, 'invalid value for "digits", must be smaller than or equal to 255.'
157
+ end
158
+
159
+ if !digits.nil? && digits < 0
160
+ fail ArgumentError, 'invalid value for "digits", must be greater than or equal to 0.'
161
+ end
162
+
163
+ @digits = digits
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ secret == o.secret &&
172
+ name == o.name &&
173
+ username == o.username &&
174
+ issuer == o.issuer &&
175
+ digits == o.digits &&
176
+ period == o.period &&
177
+ algorithm == o.algorithm
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Integer] Hash code
188
+ def hash
189
+ [secret, name, username, issuer, digits, period, algorithm].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ new.build_from_hash(attributes)
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ self.class.openapi_types.each_pair do |key, type|
205
+ if type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
209
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
213
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ MailSlurpClient.const_get(type).build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map { |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+ end
306
+ end
@@ -14,18 +14,25 @@ require 'date'
14
14
 
15
15
  module MailSlurpClient
16
16
  class CreateTotpDeviceOtpAuthUrlOptions
17
+ # OTP Auth URI for connecting a TOTP device.
17
18
  attr_accessor :otp_auth_url
18
19
 
20
+ # Name for labeling the TOTP device
19
21
  attr_accessor :name
20
22
 
23
+ # Optional username for the TOTP device
21
24
  attr_accessor :username
22
25
 
26
+ # Optional issuer override for the TOTP device
23
27
  attr_accessor :issuer
24
28
 
29
+ # Optional number of digits in TOTP code
25
30
  attr_accessor :digits
26
31
 
32
+ # Optional period in seconds for TOTP code expiration
27
33
  attr_accessor :period
28
34
 
35
+ # Optional algorithm override
29
36
  attr_accessor :algorithm
30
37
 
31
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -99,10 +106,14 @@ module MailSlurpClient
99
106
 
100
107
  if attributes.key?(:'digits')
101
108
  self.digits = attributes[:'digits']
109
+ else
110
+ self.digits = 6
102
111
  end
103
112
 
104
113
  if attributes.key?(:'period')
105
114
  self.period = attributes[:'period']
115
+ else
116
+ self.period = 30
106
117
  end
107
118
 
108
119
  if attributes.key?(:'algorithm')
@@ -118,6 +129,14 @@ module MailSlurpClient
118
129
  invalid_properties.push('invalid value for "otp_auth_url", otp_auth_url cannot be nil.')
119
130
  end
120
131
 
132
+ if !@digits.nil? && @digits > 255
133
+ invalid_properties.push('invalid value for "digits", must be smaller than or equal to 255.')
134
+ end
135
+
136
+ if !@digits.nil? && @digits < 0
137
+ invalid_properties.push('invalid value for "digits", must be greater than or equal to 0.')
138
+ end
139
+
121
140
  invalid_properties
122
141
  end
123
142
 
@@ -125,9 +144,25 @@ module MailSlurpClient
125
144
  # @return true if the model is valid
126
145
  def valid?
127
146
  return false if @otp_auth_url.nil?
147
+ return false if !@digits.nil? && @digits > 255
148
+ return false if !@digits.nil? && @digits < 0
128
149
  true
129
150
  end
130
151
 
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] digits Value to be assigned
154
+ def digits=(digits)
155
+ if !digits.nil? && digits > 255
156
+ fail ArgumentError, 'invalid value for "digits", must be smaller than or equal to 255.'
157
+ end
158
+
159
+ if !digits.nil? && digits < 0
160
+ fail ArgumentError, 'invalid value for "digits", must be greater than or equal to 0.'
161
+ end
162
+
163
+ @digits = digits
164
+ end
165
+
131
166
  # Checks equality by comparing each attribute.
132
167
  # @param [Object] Object to be compared
133
168
  def ==(o)