mailslurp_client 16.2.0 → 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 (75) 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 +88 -13
  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/alias_thread_projection.rb +11 -11
  19. data/lib/mailslurp_client/models/bounce_projection.rb +11 -11
  20. data/lib/mailslurp_client/models/conditional_structured_content_result.rb +221 -0
  21. data/lib/mailslurp_client/models/create_ai_transformer_mapping_options.rb +5 -10
  22. data/lib/mailslurp_client/models/create_domain_options.rb +19 -0
  23. data/lib/mailslurp_client/models/create_inbox_forwarder_options.rb +19 -0
  24. data/lib/mailslurp_client/models/create_inbox_replier_options.rb +19 -0
  25. data/lib/mailslurp_client/models/create_inbox_ruleset_options.rb +2 -2
  26. data/lib/mailslurp_client/models/create_totp_device_base32_secret_key_options.rb +306 -0
  27. data/lib/mailslurp_client/models/create_totp_device_custom_options.rb +306 -0
  28. data/lib/mailslurp_client/models/create_totp_device_otp_auth_url_options.rb +35 -0
  29. data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
  30. data/lib/mailslurp_client/models/describe_domain_options.rb +19 -0
  31. data/lib/mailslurp_client/models/dns_lookup_options.rb +19 -0
  32. data/lib/mailslurp_client/models/email.rb +13 -13
  33. data/lib/mailslurp_client/models/email_projection.rb +18 -18
  34. data/lib/mailslurp_client/models/email_thread_projection.rb +17 -17
  35. data/lib/mailslurp_client/models/entity_automation_item_projection.rb +10 -10
  36. data/lib/mailslurp_client/models/expiration_defaults.rb +1 -0
  37. data/lib/mailslurp_client/models/fake_email_dto.rb +1 -0
  38. data/lib/mailslurp_client/models/generate_structured_content_attachment_options.rb +1 -0
  39. data/lib/mailslurp_client/models/generate_structured_content_email_options.rb +1 -0
  40. data/lib/mailslurp_client/models/generate_structured_content_sms_options.rb +1 -0
  41. data/lib/mailslurp_client/models/inbox_exists_dto.rb +26 -4
  42. data/lib/mailslurp_client/models/inbox_ruleset_dto.rb +2 -2
  43. data/lib/mailslurp_client/models/inline_object.rb +58 -12
  44. data/lib/mailslurp_client/models/inline_object1.rb +211 -0
  45. data/lib/mailslurp_client/models/invoke_transformer_options.rb +329 -0
  46. data/lib/mailslurp_client/models/match_option.rb +19 -0
  47. data/lib/mailslurp_client/models/missed_email_dto.rb +1 -0
  48. data/lib/mailslurp_client/models/missed_email_projection.rb +11 -11
  49. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +1 -1
  50. data/lib/mailslurp_client/models/pageable_object.rb +10 -10
  51. data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +19 -19
  52. data/lib/mailslurp_client/models/phone_message_thread_projection.rb +15 -25
  53. data/lib/mailslurp_client/models/sent_email_projection.rb +38 -53
  54. data/lib/mailslurp_client/models/sms_match_option.rb +19 -0
  55. data/lib/mailslurp_client/models/sms_preview.rb +4 -0
  56. data/lib/mailslurp_client/models/structured_output_schema.rb +12 -9
  57. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +10 -10
  58. data/lib/mailslurp_client/models/update_inbox_replier_options.rb +19 -0
  59. data/lib/mailslurp_client/models/upload_attachment_options.rb +19 -0
  60. data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
  61. data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
  62. data/lib/mailslurp_client/models/webhook_delivery_status_payload.rb +2 -2
  63. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  64. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
  65. data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
  66. data/lib/mailslurp_client/models/webhook_new_ai_transform_result_payload.rb +389 -0
  67. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  68. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
  69. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  70. data/lib/mailslurp_client/models/webhook_new_sms_payload.rb +2 -2
  71. data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
  72. data/lib/mailslurp_client/models/webhook_result_dto.rb +2 -2
  73. data/lib/mailslurp_client/version.rb +1 -1
  74. data/lib/mailslurp_client.rb +8 -2
  75. metadata +10 -4
@@ -0,0 +1,221 @@
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 ConditionalStructuredContentResult
17
+ attr_accessor :result
18
+
19
+ attr_accessor :conditions_match
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'result' => :'result',
25
+ :'conditions_match' => :'conditionsMatch'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'result' => :'Object',
33
+ :'conditions_match' => :'Boolean'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ :'result',
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ConditionalStructuredContentResult` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ConditionalStructuredContentResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'result')
60
+ self.result = attributes[:'result']
61
+ end
62
+
63
+ if attributes.key?(:'conditions_match')
64
+ self.conditions_match = attributes[:'conditions_match']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @conditions_match.nil?
73
+ invalid_properties.push('invalid value for "conditions_match", conditions_match cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if @conditions_match.nil?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ result == o.result &&
92
+ conditions_match == o.conditions_match
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [result, conditions_match].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ MailSlurpClient.const_get(type).build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end
@@ -79,6 +79,11 @@ module MailSlurpClient
79
79
  # List of attributes with nullable: true
80
80
  def self.openapi_nullable
81
81
  Set.new([
82
+ :'name',
83
+ :'entity_id',
84
+ :'content_selector',
85
+ :'trigger_selector',
86
+ :'spread_root_array'
82
87
  ])
83
88
  end
84
89
 
@@ -130,18 +135,10 @@ module MailSlurpClient
130
135
  # @return Array for valid properties with the reasons
131
136
  def list_invalid_properties
132
137
  invalid_properties = Array.new
133
- if @name.nil?
134
- invalid_properties.push('invalid value for "name", name cannot be nil.')
135
- end
136
-
137
138
  if @ai_transform_id.nil?
138
139
  invalid_properties.push('invalid value for "ai_transform_id", ai_transform_id cannot be nil.')
139
140
  end
140
141
 
141
- if @entity_id.nil?
142
- invalid_properties.push('invalid value for "entity_id", entity_id cannot be nil.')
143
- end
144
-
145
142
  if @entity_type.nil?
146
143
  invalid_properties.push('invalid value for "entity_type", entity_type cannot be nil.')
147
144
  end
@@ -152,9 +149,7 @@ module MailSlurpClient
152
149
  # Check to see if the all the properties in the model are valid
153
150
  # @return true if the model is valid
154
151
  def valid?
155
- return false if @name.nil?
156
152
  return false if @ai_transform_id.nil?
157
- return false if @entity_id.nil?
158
153
  return false if @entity_type.nil?
159
154
  entity_type_validator = EnumAttributeValidator.new('String', ["INBOX", "PHONE"])
160
155
  return false unless entity_type_validator.valid?(@entity_type)
@@ -118,6 +118,10 @@ module MailSlurpClient
118
118
  invalid_properties.push('invalid value for "domain", domain cannot be nil.')
119
119
  end
120
120
 
121
+ if @domain.to_s.length < 1
122
+ invalid_properties.push('invalid value for "domain", the character length must be great than or equal to 1.')
123
+ end
124
+
121
125
  invalid_properties
122
126
  end
123
127
 
@@ -125,11 +129,26 @@ module MailSlurpClient
125
129
  # @return true if the model is valid
126
130
  def valid?
127
131
  return false if @domain.nil?
132
+ return false if @domain.to_s.length < 1
128
133
  domain_type_validator = EnumAttributeValidator.new('String', ["HTTP_INBOX", "SMTP_DOMAIN"])
129
134
  return false unless domain_type_validator.valid?(@domain_type)
130
135
  true
131
136
  end
132
137
 
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] domain Value to be assigned
140
+ def domain=(domain)
141
+ if domain.nil?
142
+ fail ArgumentError, 'domain cannot be nil'
143
+ end
144
+
145
+ if domain.to_s.length < 1
146
+ fail ArgumentError, 'invalid value for "domain", the character length must be great than or equal to 1.'
147
+ end
148
+
149
+ @domain = domain
150
+ end
151
+
133
152
  # Custom attribute writer method checking allowed values (enum).
134
153
  # @param [Object] domain_type Object to be assigned
135
154
  def domain_type=(domain_type)
@@ -112,6 +112,10 @@ module MailSlurpClient
112
112
  invalid_properties.push('invalid value for "match", match cannot be nil.')
113
113
  end
114
114
 
115
+ if @match.to_s.length < 1
116
+ invalid_properties.push('invalid value for "match", the character length must be great than or equal to 1.')
117
+ end
118
+
115
119
  if @forward_to_recipients.nil?
116
120
  invalid_properties.push('invalid value for "forward_to_recipients", forward_to_recipients cannot be nil.')
117
121
  end
@@ -126,6 +130,7 @@ module MailSlurpClient
126
130
  field_validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS"])
127
131
  return false unless field_validator.valid?(@field)
128
132
  return false if @match.nil?
133
+ return false if @match.to_s.length < 1
129
134
  return false if @forward_to_recipients.nil?
130
135
  true
131
136
  end
@@ -140,6 +145,20 @@ module MailSlurpClient
140
145
  @field = field
141
146
  end
142
147
 
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] match Value to be assigned
150
+ def match=(match)
151
+ if match.nil?
152
+ fail ArgumentError, 'match cannot be nil'
153
+ end
154
+
155
+ if match.to_s.length < 1
156
+ fail ArgumentError, 'invalid value for "match", the character length must be great than or equal to 1.'
157
+ end
158
+
159
+ @match = match
160
+ end
161
+
143
162
  # Checks equality by comparing each attribute.
144
163
  # @param [Object] Object to be compared
145
164
  def ==(o)
@@ -213,6 +213,10 @@ module MailSlurpClient
213
213
  invalid_properties.push('invalid value for "match", match cannot be nil.')
214
214
  end
215
215
 
216
+ if @match.to_s.length < 1
217
+ invalid_properties.push('invalid value for "match", the character length must be great than or equal to 1.')
218
+ end
219
+
216
220
  invalid_properties
217
221
  end
218
222
 
@@ -223,6 +227,7 @@ module MailSlurpClient
223
227
  field_validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS"])
224
228
  return false unless field_validator.valid?(@field)
225
229
  return false if @match.nil?
230
+ return false if @match.to_s.length < 1
226
231
  true
227
232
  end
228
233
 
@@ -236,6 +241,20 @@ module MailSlurpClient
236
241
  @field = field
237
242
  end
238
243
 
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] match Value to be assigned
246
+ def match=(match)
247
+ if match.nil?
248
+ fail ArgumentError, 'match cannot be nil'
249
+ end
250
+
251
+ if match.to_s.length < 1
252
+ fail ArgumentError, 'invalid value for "match", the character length must be great than or equal to 1.'
253
+ end
254
+
255
+ @match = match
256
+ end
257
+
239
258
  # Checks equality by comparing each attribute.
240
259
  # @param [Object] Object to be compared
241
260
  def ==(o)
@@ -124,7 +124,7 @@ module MailSlurpClient
124
124
  scope_validator = EnumAttributeValidator.new('String', ["RECEIVING_EMAILS", "SENDING_EMAILS"])
125
125
  return false unless scope_validator.valid?(@scope)
126
126
  return false if @action.nil?
127
- action_validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE"])
127
+ action_validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE", "BOUNCE_SOFT", "BOUNCE_HARD"])
128
128
  return false unless action_validator.valid?(@action)
129
129
  return false if @target.nil?
130
130
  true
@@ -143,7 +143,7 @@ module MailSlurpClient
143
143
  # Custom attribute writer method checking allowed values (enum).
144
144
  # @param [Object] action Object to be assigned
145
145
  def action=(action)
146
- validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE"])
146
+ validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE", "BOUNCE_SOFT", "BOUNCE_HARD"])
147
147
  unless validator.valid?(action)
148
148
  fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
149
149
  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 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