mailslurp_client 17.3.0 → 17.4.0

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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/attachment_controller_api.rb +5 -5
  3. data/lib/mailslurp_client/api/email_controller_api.rb +2 -2
  4. data/lib/mailslurp_client/api/email_verification_controller_api.rb +64 -0
  5. data/lib/mailslurp_client/api/inbox_controller_api.rb +229 -0
  6. data/lib/mailslurp_client/api/phone_controller_api.rb +334 -0
  7. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +13 -13
  8. data/lib/mailslurp_client/models/alias_projection.rb +29 -29
  9. data/lib/mailslurp_client/models/alias_thread_projection.rb +16 -16
  10. data/lib/mailslurp_client/models/attachment_projection.rb +29 -29
  11. data/lib/mailslurp_client/models/bounce_recipient_projection.rb +15 -15
  12. data/lib/mailslurp_client/models/connector_event_projection.rb +30 -30
  13. data/lib/mailslurp_client/models/connector_projection.rb +10 -10
  14. data/lib/mailslurp_client/models/contact_projection.rb +15 -15
  15. data/lib/mailslurp_client/models/create_inbox_forwarder_options.rb +58 -29
  16. data/lib/mailslurp_client/models/create_inbox_replier_options.rb +39 -33
  17. data/lib/mailslurp_client/models/create_phone_number_options.rb +37 -4
  18. data/lib/mailslurp_client/models/email_intelligence_list_result.rb +285 -0
  19. data/lib/mailslurp_client/models/email_intelligence_options.rb +308 -0
  20. data/lib/mailslurp_client/models/email_intelligence_result_dto.rb +256 -0
  21. data/lib/mailslurp_client/models/email_intelligence_score_breakdown_dto.rb +296 -0
  22. data/lib/mailslurp_client/models/email_intelligence_signals_dto.rb +352 -0
  23. data/lib/mailslurp_client/models/email_intelligence_tests_options.rb +253 -0
  24. data/lib/mailslurp_client/models/email_thread_projection.rb +16 -16
  25. data/lib/mailslurp_client/models/entity_favourite_item_projection.rb +13 -13
  26. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  27. data/lib/mailslurp_client/models/extract_attachment_text_options.rb +1 -1
  28. data/lib/mailslurp_client/models/extract_attachment_text_result.rb +1 -1
  29. data/lib/mailslurp_client/models/group_projection.rb +14 -14
  30. data/lib/mailslurp_client/models/guest_portal_user_projection.rb +24 -24
  31. data/lib/mailslurp_client/models/import_email_options.rb +269 -0
  32. data/lib/mailslurp_client/models/inbox_automation_match_option.rb +308 -0
  33. data/lib/mailslurp_client/models/inbox_automation_match_options.rb +273 -0
  34. data/lib/mailslurp_client/models/inbox_forwarder_dto.rb +65 -17
  35. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +16 -16
  36. data/lib/mailslurp_client/models/inbox_forwarder_test_options.rb +17 -9
  37. data/lib/mailslurp_client/models/inbox_replier_dto.rb +41 -16
  38. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +16 -16
  39. data/lib/mailslurp_client/models/inline_object.rb +12 -58
  40. data/lib/mailslurp_client/models/inline_object1.rb +58 -12
  41. data/lib/mailslurp_client/models/inline_object2.rb +211 -0
  42. data/lib/mailslurp_client/models/opt_in_identity_projection.rb +18 -18
  43. data/lib/mailslurp_client/models/page_ai_transform_mapping_projection.rb +24 -24
  44. data/lib/mailslurp_client/models/page_ai_transform_projection.rb +24 -24
  45. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +24 -24
  46. data/lib/mailslurp_client/models/page_alias.rb +24 -24
  47. data/lib/mailslurp_client/models/page_alias_thread_projection.rb +24 -24
  48. data/lib/mailslurp_client/models/page_attachment_entity.rb +24 -24
  49. data/lib/mailslurp_client/models/page_bounced_email.rb +24 -24
  50. data/lib/mailslurp_client/models/page_bounced_recipients.rb +24 -24
  51. data/lib/mailslurp_client/models/page_complaint.rb +24 -24
  52. data/lib/mailslurp_client/models/page_connector.rb +24 -24
  53. data/lib/mailslurp_client/models/page_connector_events.rb +24 -24
  54. data/lib/mailslurp_client/models/page_contact_projection.rb +24 -24
  55. data/lib/mailslurp_client/models/page_delivery_status.rb +24 -24
  56. data/lib/mailslurp_client/models/page_device_preview_run_projection.rb +24 -24
  57. data/lib/mailslurp_client/models/page_email_preview.rb +24 -24
  58. data/lib/mailslurp_client/models/page_email_projection.rb +24 -24
  59. data/lib/mailslurp_client/models/page_email_thread_projection.rb +24 -24
  60. data/lib/mailslurp_client/models/page_email_validation_request.rb +24 -24
  61. data/lib/mailslurp_client/models/page_entity_automation_items.rb +24 -24
  62. data/lib/mailslurp_client/models/page_entity_event_items.rb +24 -24
  63. data/lib/mailslurp_client/models/page_entity_favourite_items.rb +24 -24
  64. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +24 -24
  65. data/lib/mailslurp_client/models/page_group_projection.rb +24 -24
  66. data/lib/mailslurp_client/models/page_guest_portal_users.rb +24 -24
  67. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +24 -24
  68. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +24 -24
  69. data/lib/mailslurp_client/models/page_inbox_projection.rb +24 -24
  70. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +24 -24
  71. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +24 -24
  72. data/lib/mailslurp_client/models/page_inbox_tags.rb +24 -24
  73. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +24 -24
  74. data/lib/mailslurp_client/models/page_missed_email_projection.rb +24 -24
  75. data/lib/mailslurp_client/models/page_missed_sms_projection.rb +24 -24
  76. data/lib/mailslurp_client/models/page_opt_in_identity_projection.rb +24 -24
  77. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +24 -24
  78. data/lib/mailslurp_client/models/page_phone_message_thread_item_projection.rb +24 -24
  79. data/lib/mailslurp_client/models/page_phone_message_thread_projection.rb +24 -24
  80. data/lib/mailslurp_client/models/page_phone_number_projection.rb +24 -24
  81. data/lib/mailslurp_client/models/page_phone_number_release_projection.rb +24 -24
  82. data/lib/mailslurp_client/models/page_plus_address_projection.rb +24 -24
  83. data/lib/mailslurp_client/models/page_reputation_items.rb +24 -24
  84. data/lib/mailslurp_client/models/page_ruleset_dto.rb +24 -24
  85. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +24 -24
  86. data/lib/mailslurp_client/models/page_sent_email_projection.rb +24 -24
  87. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +24 -24
  88. data/lib/mailslurp_client/models/page_sent_sms_projection.rb +24 -24
  89. data/lib/mailslurp_client/models/page_sms_projection.rb +24 -24
  90. data/lib/mailslurp_client/models/page_template_projection.rb +24 -24
  91. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +24 -24
  92. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +24 -24
  93. data/lib/mailslurp_client/models/page_webhook_endpoint_projection.rb +24 -24
  94. data/lib/mailslurp_client/models/page_webhook_projection.rb +24 -24
  95. data/lib/mailslurp_client/models/page_webhook_result.rb +24 -24
  96. data/lib/mailslurp_client/models/pageable_object.rb +13 -13
  97. data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +15 -15
  98. data/lib/mailslurp_client/models/phone_number_dto.rb +17 -1
  99. data/lib/mailslurp_client/models/phone_number_tags_options.rb +213 -0
  100. data/lib/mailslurp_client/models/plus_address_projection.rb +15 -15
  101. data/lib/mailslurp_client/models/reputation_item_projection.rb +13 -13
  102. data/lib/mailslurp_client/models/template_projection.rb +15 -15
  103. data/lib/mailslurp_client/models/update_inbox_replier_options.rb +39 -33
  104. data/lib/mailslurp_client/models/webhook_projection.rb +15 -15
  105. data/lib/mailslurp_client/version.rb +1 -1
  106. data/lib/mailslurp_client.rb +11 -0
  107. metadata +13 -2
@@ -0,0 +1,269 @@
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
+ # Options for importing a raw RFC822/MIME email into a specific inbox. V1 supports MIME-family formats such as `.eml`, `message/rfc822`, and raw MIME bytes. Outlook `.msg`, `mbox`, and `maildir` are not supported in V1.
17
+ class ImportEmailOptions
18
+ # Base64 encoded RFC822/MIME email contents. This should be the full raw email including headers and body, such as the bytes from an `.eml` file.
19
+ attr_accessor :raw_email_base64
20
+
21
+ # Optional external identifier for the imported email source. Useful for correlating imports back to another system.
22
+ attr_accessor :external_id
23
+
24
+ # When true the normal inbound receive pipeline runs after persistence, including automations, webhooks, transformers, forwarders, repliers, and related fanout. When false the email is stored only.
25
+ attr_accessor :run_pipeline
26
+
27
+ # When true MailSlurp rewrites the MIME `Message-ID` header before storing and parsing the email so imported messages do not collide with existing message identities.
28
+ attr_accessor :override_message_id
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'raw_email_base64' => :'rawEmailBase64',
34
+ :'external_id' => :'externalId',
35
+ :'run_pipeline' => :'runPipeline',
36
+ :'override_message_id' => :'overrideMessageId'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'raw_email_base64' => :'String',
44
+ :'external_id' => :'String',
45
+ :'run_pipeline' => :'Boolean',
46
+ :'override_message_id' => :'Boolean'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :'external_id',
54
+ :'run_pipeline',
55
+ :'override_message_id'
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImportEmailOptions` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImportEmailOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'raw_email_base64')
75
+ self.raw_email_base64 = attributes[:'raw_email_base64']
76
+ end
77
+
78
+ if attributes.key?(:'external_id')
79
+ self.external_id = attributes[:'external_id']
80
+ end
81
+
82
+ if attributes.key?(:'run_pipeline')
83
+ self.run_pipeline = attributes[:'run_pipeline']
84
+ else
85
+ self.run_pipeline = false
86
+ end
87
+
88
+ if attributes.key?(:'override_message_id')
89
+ self.override_message_id = attributes[:'override_message_id']
90
+ else
91
+ self.override_message_id = true
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @raw_email_base64.nil?
100
+ invalid_properties.push('invalid value for "raw_email_base64", raw_email_base64 cannot be nil.')
101
+ end
102
+
103
+ if @raw_email_base64.to_s.length < 1
104
+ invalid_properties.push('invalid value for "raw_email_base64", the character length must be great than or equal to 1.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if @raw_email_base64.nil?
114
+ return false if @raw_email_base64.to_s.length < 1
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] raw_email_base64 Value to be assigned
120
+ def raw_email_base64=(raw_email_base64)
121
+ if raw_email_base64.nil?
122
+ fail ArgumentError, 'raw_email_base64 cannot be nil'
123
+ end
124
+
125
+ if raw_email_base64.to_s.length < 1
126
+ fail ArgumentError, 'invalid value for "raw_email_base64", the character length must be great than or equal to 1.'
127
+ end
128
+
129
+ @raw_email_base64 = raw_email_base64
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ raw_email_base64 == o.raw_email_base64 &&
138
+ external_id == o.external_id &&
139
+ run_pipeline == o.run_pipeline &&
140
+ override_message_id == o.override_message_id
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [raw_email_base64, external_id, run_pipeline, override_message_id].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ new.build_from_hash(attributes)
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.openapi_types.each_pair do |key, type|
168
+ if type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
172
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
173
+ end
174
+ elsif !attributes[self.class.attribute_map[key]].nil?
175
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
177
+ end
178
+
179
+ self
180
+ end
181
+
182
+ # Deserializes the data based on type
183
+ # @param string type Data type
184
+ # @param string value Value to be deserialized
185
+ # @return [Object] Deserialized data
186
+ def _deserialize(type, value)
187
+ case type.to_sym
188
+ when :DateTime
189
+ DateTime.parse(value)
190
+ when :Date
191
+ Date.parse(value)
192
+ when :String
193
+ value.to_s
194
+ when :Integer
195
+ value.to_i
196
+ when :Float
197
+ value.to_f
198
+ when :Boolean
199
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
200
+ true
201
+ else
202
+ false
203
+ end
204
+ when :Object
205
+ # generic object (usually a Hash), return directly
206
+ value
207
+ when /\AArray<(?<inner_type>.+)>\z/
208
+ inner_type = Regexp.last_match[:inner_type]
209
+ value.map { |v| _deserialize(inner_type, v) }
210
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
211
+ k_type = Regexp.last_match[:k_type]
212
+ v_type = Regexp.last_match[:v_type]
213
+ {}.tap do |hash|
214
+ value.each do |k, v|
215
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
216
+ end
217
+ end
218
+ else # model
219
+ MailSlurpClient.const_get(type).build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+ end
269
+ end
@@ -0,0 +1,308 @@
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
+ # Single inbox automation match rule.
17
+ class InboxAutomationMatchOption
18
+ # Supported fields for inbox forwarder and replier automation matching.
19
+ attr_accessor :field
20
+
21
+ # Comparison mode for inbox automation matching.
22
+ attr_accessor :should
23
+
24
+ # Pattern or value to compare against the selected field.
25
+ attr_accessor :value
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'field' => :'field',
53
+ :'should' => :'should',
54
+ :'value' => :'value'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'field' => :'String',
62
+ :'should' => :'String',
63
+ :'value' => :'String'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InboxAutomationMatchOption` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InboxAutomationMatchOption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'field')
89
+ self.field = attributes[:'field']
90
+ end
91
+
92
+ if attributes.key?(:'should')
93
+ self.should = attributes[:'should']
94
+ end
95
+
96
+ if attributes.key?(:'value')
97
+ self.value = attributes[:'value']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if @field.nil?
106
+ invalid_properties.push('invalid value for "field", field cannot be nil.')
107
+ end
108
+
109
+ if @should.nil?
110
+ invalid_properties.push('invalid value for "should", should cannot be nil.')
111
+ end
112
+
113
+ if @value.nil?
114
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
115
+ end
116
+
117
+ if @value.to_s.length < 1
118
+ invalid_properties.push('invalid value for "value", the character length must be great than or equal to 1.')
119
+ end
120
+
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ return false if @field.nil?
128
+ field_validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS", "ATTACHMENT_FILENAME", "ATTACHMENT_TEXT"])
129
+ return false unless field_validator.valid?(@field)
130
+ return false if @should.nil?
131
+ should_validator = EnumAttributeValidator.new('String', ["WILDCARD", "MATCH", "CONTAIN", "EQUAL"])
132
+ return false unless should_validator.valid?(@should)
133
+ return false if @value.nil?
134
+ return false if @value.to_s.length < 1
135
+ true
136
+ end
137
+
138
+ # Custom attribute writer method checking allowed values (enum).
139
+ # @param [Object] field Object to be assigned
140
+ def field=(field)
141
+ validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS", "ATTACHMENT_FILENAME", "ATTACHMENT_TEXT"])
142
+ unless validator.valid?(field)
143
+ fail ArgumentError, "invalid value for \"field\", must be one of #{validator.allowable_values}."
144
+ end
145
+ @field = field
146
+ end
147
+
148
+ # Custom attribute writer method checking allowed values (enum).
149
+ # @param [Object] should Object to be assigned
150
+ def should=(should)
151
+ validator = EnumAttributeValidator.new('String', ["WILDCARD", "MATCH", "CONTAIN", "EQUAL"])
152
+ unless validator.valid?(should)
153
+ fail ArgumentError, "invalid value for \"should\", must be one of #{validator.allowable_values}."
154
+ end
155
+ @should = should
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] value Value to be assigned
160
+ def value=(value)
161
+ if value.nil?
162
+ fail ArgumentError, 'value cannot be nil'
163
+ end
164
+
165
+ if value.to_s.length < 1
166
+ fail ArgumentError, 'invalid value for "value", the character length must be great than or equal to 1.'
167
+ end
168
+
169
+ @value = value
170
+ end
171
+
172
+ # Checks equality by comparing each attribute.
173
+ # @param [Object] Object to be compared
174
+ def ==(o)
175
+ return true if self.equal?(o)
176
+ self.class == o.class &&
177
+ field == o.field &&
178
+ should == o.should &&
179
+ value == o.value
180
+ end
181
+
182
+ # @see the `==` method
183
+ # @param [Object] Object to be compared
184
+ def eql?(o)
185
+ self == o
186
+ end
187
+
188
+ # Calculates hash code according to all attributes.
189
+ # @return [Integer] Hash code
190
+ def hash
191
+ [field, should, value].hash
192
+ end
193
+
194
+ # Builds the object from hash
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @return [Object] Returns the model itself
197
+ def self.build_from_hash(attributes)
198
+ new.build_from_hash(attributes)
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def build_from_hash(attributes)
205
+ return nil unless attributes.is_a?(Hash)
206
+ self.class.openapi_types.each_pair do |key, type|
207
+ if type =~ /\AArray<(.*)>/i
208
+ # check to ensure the input is an array given that the attribute
209
+ # is documented as an array but the input is not
210
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
211
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
212
+ end
213
+ elsif !attributes[self.class.attribute_map[key]].nil?
214
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
215
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
216
+ end
217
+
218
+ self
219
+ end
220
+
221
+ # Deserializes the data based on type
222
+ # @param string type Data type
223
+ # @param string value Value to be deserialized
224
+ # @return [Object] Deserialized data
225
+ def _deserialize(type, value)
226
+ case type.to_sym
227
+ when :DateTime
228
+ DateTime.parse(value)
229
+ when :Date
230
+ Date.parse(value)
231
+ when :String
232
+ value.to_s
233
+ when :Integer
234
+ value.to_i
235
+ when :Float
236
+ value.to_f
237
+ when :Boolean
238
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
239
+ true
240
+ else
241
+ false
242
+ end
243
+ when :Object
244
+ # generic object (usually a Hash), return directly
245
+ value
246
+ when /\AArray<(?<inner_type>.+)>\z/
247
+ inner_type = Regexp.last_match[:inner_type]
248
+ value.map { |v| _deserialize(inner_type, v) }
249
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
250
+ k_type = Regexp.last_match[:k_type]
251
+ v_type = Regexp.last_match[:v_type]
252
+ {}.tap do |hash|
253
+ value.each do |k, v|
254
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
255
+ end
256
+ end
257
+ else # model
258
+ MailSlurpClient.const_get(type).build_from_hash(value)
259
+ end
260
+ end
261
+
262
+ # Returns the string representation of the object
263
+ # @return [String] String presentation of the object
264
+ def to_s
265
+ to_hash.to_s
266
+ end
267
+
268
+ # to_body is an alias to to_hash (backward compatibility)
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_body
271
+ to_hash
272
+ end
273
+
274
+ # Returns the object in the form of hash
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_hash
277
+ hash = {}
278
+ self.class.attribute_map.each_pair do |attr, param|
279
+ value = self.send(attr)
280
+ if value.nil?
281
+ is_nullable = self.class.openapi_nullable.include?(attr)
282
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
283
+ end
284
+
285
+ hash[param] = _to_hash(value)
286
+ end
287
+ hash
288
+ end
289
+
290
+ # Outputs non-array value in the form of hash
291
+ # For object, use to_hash. Otherwise, just return the value
292
+ # @param [Object] value Any valid value
293
+ # @return [Hash] Returns the value in the form of hash
294
+ def _to_hash(value)
295
+ if value.is_a?(Array)
296
+ value.compact.map { |v| _to_hash(v) }
297
+ elsif value.is_a?(Hash)
298
+ {}.tap do |hash|
299
+ value.each { |k, v| hash[k] = _to_hash(v) }
300
+ end
301
+ elsif value.respond_to? :to_hash
302
+ value.to_hash
303
+ else
304
+ value
305
+ end
306
+ end
307
+ end
308
+ end