mailslurp_client 16.1.3 → 16.1.5

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/ai_controller_api.rb +813 -6
  3. data/lib/mailslurp_client/models/ai_tranform_create_options.rb +237 -0
  4. data/lib/mailslurp_client/models/ai_transform_dto.rb +251 -0
  5. data/lib/mailslurp_client/models/ai_transform_mapping_dto.rb +310 -0
  6. data/lib/mailslurp_client/models/ai_transform_mapping_projection.rb +352 -0
  7. data/lib/mailslurp_client/models/ai_transform_projection.rb +251 -0
  8. data/lib/mailslurp_client/models/ai_transform_result_dto.rb +353 -0
  9. data/lib/mailslurp_client/models/ai_transform_result_projection.rb +324 -0
  10. data/lib/mailslurp_client/models/alias_projection.rb +15 -15
  11. data/lib/mailslurp_client/models/alias_thread_projection.rb +16 -16
  12. data/lib/mailslurp_client/models/attachment_projection.rb +10 -10
  13. data/lib/mailslurp_client/models/connector_projection.rb +15 -15
  14. data/lib/mailslurp_client/models/create_ai_transformer_mapping_options.rb +338 -0
  15. data/lib/mailslurp_client/models/create_webhook_options.rb +12 -1
  16. data/lib/mailslurp_client/models/email_projection.rb +10 -10
  17. data/lib/mailslurp_client/models/email_thread_projection.rb +36 -36
  18. data/lib/mailslurp_client/models/generate_structured_content_attachment_options.rb +27 -9
  19. data/lib/mailslurp_client/models/generate_structured_content_email_options.rb +19 -11
  20. data/lib/mailslurp_client/models/generate_structured_content_sms_options.rb +244 -0
  21. data/lib/mailslurp_client/models/guest_portal_user_projection.rb +10 -10
  22. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +11 -11
  23. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +11 -11
  24. data/lib/mailslurp_client/models/page_ai_transform_mapping_projection.rb +309 -0
  25. data/lib/mailslurp_client/models/page_ai_transform_projection.rb +309 -0
  26. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +309 -0
  27. data/lib/mailslurp_client/models/page_alias.rb +15 -15
  28. data/lib/mailslurp_client/models/page_alias_thread_projection.rb +15 -15
  29. data/lib/mailslurp_client/models/page_attachment_entity.rb +15 -15
  30. data/lib/mailslurp_client/models/page_bounced_email.rb +15 -15
  31. data/lib/mailslurp_client/models/page_bounced_recipients.rb +15 -15
  32. data/lib/mailslurp_client/models/page_complaint.rb +15 -15
  33. data/lib/mailslurp_client/models/page_connector.rb +15 -15
  34. data/lib/mailslurp_client/models/page_connector_events.rb +15 -15
  35. data/lib/mailslurp_client/models/page_contact_projection.rb +15 -15
  36. data/lib/mailslurp_client/models/page_delivery_status.rb +15 -15
  37. data/lib/mailslurp_client/models/page_email_preview.rb +15 -15
  38. data/lib/mailslurp_client/models/page_email_projection.rb +15 -15
  39. data/lib/mailslurp_client/models/page_email_thread_projection.rb +15 -15
  40. data/lib/mailslurp_client/models/page_email_validation_request.rb +15 -15
  41. data/lib/mailslurp_client/models/page_entity_automation_items.rb +15 -15
  42. data/lib/mailslurp_client/models/page_entity_event_items.rb +15 -15
  43. data/lib/mailslurp_client/models/page_entity_favourite_items.rb +15 -15
  44. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +15 -15
  45. data/lib/mailslurp_client/models/page_group_projection.rb +15 -15
  46. data/lib/mailslurp_client/models/page_guest_portal_users.rb +15 -15
  47. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +15 -15
  48. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +15 -15
  49. data/lib/mailslurp_client/models/page_inbox_projection.rb +15 -15
  50. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +15 -15
  51. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +15 -15
  52. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +15 -15
  53. data/lib/mailslurp_client/models/page_inbox_tags.rb +15 -15
  54. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +15 -15
  55. data/lib/mailslurp_client/models/page_missed_email_projection.rb +15 -15
  56. data/lib/mailslurp_client/models/page_opt_in_identity_projection.rb +15 -15
  57. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +15 -15
  58. data/lib/mailslurp_client/models/page_phone_message_thread_item_projection.rb +15 -15
  59. data/lib/mailslurp_client/models/page_phone_message_thread_projection.rb +15 -15
  60. data/lib/mailslurp_client/models/page_phone_number_projection.rb +15 -15
  61. data/lib/mailslurp_client/models/page_plus_address_projection.rb +15 -15
  62. data/lib/mailslurp_client/models/page_reputation_items.rb +15 -15
  63. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +15 -15
  64. data/lib/mailslurp_client/models/page_sent_email_projection.rb +15 -15
  65. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +15 -15
  66. data/lib/mailslurp_client/models/page_sent_sms_projection.rb +15 -15
  67. data/lib/mailslurp_client/models/page_sms_projection.rb +15 -15
  68. data/lib/mailslurp_client/models/page_template_projection.rb +15 -15
  69. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +15 -15
  70. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +15 -15
  71. data/lib/mailslurp_client/models/page_webhook_endpoint_projection.rb +15 -15
  72. data/lib/mailslurp_client/models/page_webhook_projection.rb +15 -15
  73. data/lib/mailslurp_client/models/page_webhook_result.rb +15 -15
  74. data/lib/mailslurp_client/models/plus_address_projection.rb +15 -15
  75. data/lib/mailslurp_client/models/sent_email_projection.rb +15 -15
  76. data/lib/mailslurp_client/models/sort_object.rb +10 -10
  77. data/lib/mailslurp_client/models/{structured_content_result.rb → structured_content_result_dto.rb} +3 -3
  78. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  79. data/lib/mailslurp_client/models/webhook_dto.rb +12 -1
  80. data/lib/mailslurp_client/models/webhook_projection.rb +19 -10
  81. data/lib/mailslurp_client/version.rb +1 -1
  82. data/lib/mailslurp_client.rb +13 -1
  83. metadata +15 -3
@@ -0,0 +1,310 @@
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 AITransformMappingDto
17
+ attr_accessor :id
18
+
19
+ attr_accessor :ai_transform_id
20
+
21
+ attr_accessor :user_id
22
+
23
+ attr_accessor :name
24
+
25
+ attr_accessor :entity_id
26
+
27
+ attr_accessor :entity_type
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
+ :'ai_transform_id' => :'aiTransformId',
56
+ :'user_id' => :'userId',
57
+ :'name' => :'name',
58
+ :'entity_id' => :'entityId',
59
+ :'entity_type' => :'entityType'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'id' => :'String',
67
+ :'ai_transform_id' => :'String',
68
+ :'user_id' => :'String',
69
+ :'name' => :'String',
70
+ :'entity_id' => :'String',
71
+ :'entity_type' => :'String'
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::AITransformMappingDto` 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::AITransformMappingDto`. 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?(:'ai_transform_id')
101
+ self.ai_transform_id = attributes[:'ai_transform_id']
102
+ end
103
+
104
+ if attributes.key?(:'user_id')
105
+ self.user_id = attributes[:'user_id']
106
+ end
107
+
108
+ if attributes.key?(:'name')
109
+ self.name = attributes[:'name']
110
+ end
111
+
112
+ if attributes.key?(:'entity_id')
113
+ self.entity_id = attributes[:'entity_id']
114
+ end
115
+
116
+ if attributes.key?(:'entity_type')
117
+ self.entity_type = attributes[:'entity_type']
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 @ai_transform_id.nil?
130
+ invalid_properties.push('invalid value for "ai_transform_id", ai_transform_id cannot be nil.')
131
+ end
132
+
133
+ if @user_id.nil?
134
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
135
+ end
136
+
137
+ if @entity_id.nil?
138
+ invalid_properties.push('invalid value for "entity_id", entity_id cannot be nil.')
139
+ end
140
+
141
+ if @entity_type.nil?
142
+ invalid_properties.push('invalid value for "entity_type", entity_type 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 @ai_transform_id.nil?
153
+ return false if @user_id.nil?
154
+ return false if @entity_id.nil?
155
+ return false if @entity_type.nil?
156
+ entity_type_validator = EnumAttributeValidator.new('String', ["INBOX", "PHONE"])
157
+ return false unless entity_type_validator.valid?(@entity_type)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] entity_type Object to be assigned
163
+ def entity_type=(entity_type)
164
+ validator = EnumAttributeValidator.new('String', ["INBOX", "PHONE"])
165
+ unless validator.valid?(entity_type)
166
+ fail ArgumentError, "invalid value for \"entity_type\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @entity_type = entity_type
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ id == o.id &&
177
+ ai_transform_id == o.ai_transform_id &&
178
+ user_id == o.user_id &&
179
+ name == o.name &&
180
+ entity_id == o.entity_id &&
181
+ entity_type == o.entity_type
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [id, ai_transform_id, user_id, name, entity_id, entity_type].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ end
219
+
220
+ self
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def _deserialize(type, value)
228
+ case type.to_sym
229
+ when :DateTime
230
+ DateTime.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ MailSlurpClient.const_get(type).build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+ end
310
+ end
@@ -0,0 +1,352 @@
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 AITransformMappingProjection
17
+ attr_accessor :user_id
18
+
19
+ attr_accessor :ai_transform_id
20
+
21
+ attr_accessor :entity_id
22
+
23
+ attr_accessor :entity_type
24
+
25
+ attr_accessor :content_selector
26
+
27
+ attr_accessor :trigger_selector
28
+
29
+ attr_accessor :name
30
+
31
+ attr_accessor :id
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'user_id' => :'userId',
59
+ :'ai_transform_id' => :'aiTransformId',
60
+ :'entity_id' => :'entityId',
61
+ :'entity_type' => :'entityType',
62
+ :'content_selector' => :'contentSelector',
63
+ :'trigger_selector' => :'triggerSelector',
64
+ :'name' => :'name',
65
+ :'id' => :'id'
66
+ }
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'user_id' => :'String',
73
+ :'ai_transform_id' => :'String',
74
+ :'entity_id' => :'String',
75
+ :'entity_type' => :'String',
76
+ :'content_selector' => :'String',
77
+ :'trigger_selector' => :'String',
78
+ :'name' => :'String',
79
+ :'id' => :'String'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::AITransformMappingProjection` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::AITransformMappingProjection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'user_id')
105
+ self.user_id = attributes[:'user_id']
106
+ end
107
+
108
+ if attributes.key?(:'ai_transform_id')
109
+ self.ai_transform_id = attributes[:'ai_transform_id']
110
+ end
111
+
112
+ if attributes.key?(:'entity_id')
113
+ self.entity_id = attributes[:'entity_id']
114
+ end
115
+
116
+ if attributes.key?(:'entity_type')
117
+ self.entity_type = attributes[:'entity_type']
118
+ end
119
+
120
+ if attributes.key?(:'content_selector')
121
+ self.content_selector = attributes[:'content_selector']
122
+ end
123
+
124
+ if attributes.key?(:'trigger_selector')
125
+ self.trigger_selector = attributes[:'trigger_selector']
126
+ end
127
+
128
+ if attributes.key?(:'name')
129
+ self.name = attributes[:'name']
130
+ end
131
+
132
+ if attributes.key?(:'id')
133
+ self.id = attributes[:'id']
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ if @user_id.nil?
142
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
143
+ end
144
+
145
+ if @ai_transform_id.nil?
146
+ invalid_properties.push('invalid value for "ai_transform_id", ai_transform_id cannot be nil.')
147
+ end
148
+
149
+ if @entity_id.nil?
150
+ invalid_properties.push('invalid value for "entity_id", entity_id cannot be nil.')
151
+ end
152
+
153
+ if @entity_type.nil?
154
+ invalid_properties.push('invalid value for "entity_type", entity_type cannot be nil.')
155
+ end
156
+
157
+ if @id.nil?
158
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
159
+ end
160
+
161
+ invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ return false if @user_id.nil?
168
+ return false if @ai_transform_id.nil?
169
+ return false if @entity_id.nil?
170
+ return false if @entity_type.nil?
171
+ entity_type_validator = EnumAttributeValidator.new('String', ["INBOX", "PHONE"])
172
+ return false unless entity_type_validator.valid?(@entity_type)
173
+ content_selector_validator = EnumAttributeValidator.new('String', ["RAW", "BODY", "BODY_ATTACHMENTS"])
174
+ return false unless content_selector_validator.valid?(@content_selector)
175
+ trigger_selector_validator = EnumAttributeValidator.new('String', ["PER_MESSAGE", "PER_ATTACHMENT"])
176
+ return false unless trigger_selector_validator.valid?(@trigger_selector)
177
+ return false if @id.nil?
178
+ true
179
+ end
180
+
181
+ # Custom attribute writer method checking allowed values (enum).
182
+ # @param [Object] entity_type Object to be assigned
183
+ def entity_type=(entity_type)
184
+ validator = EnumAttributeValidator.new('String', ["INBOX", "PHONE"])
185
+ unless validator.valid?(entity_type)
186
+ fail ArgumentError, "invalid value for \"entity_type\", must be one of #{validator.allowable_values}."
187
+ end
188
+ @entity_type = entity_type
189
+ end
190
+
191
+ # Custom attribute writer method checking allowed values (enum).
192
+ # @param [Object] content_selector Object to be assigned
193
+ def content_selector=(content_selector)
194
+ validator = EnumAttributeValidator.new('String', ["RAW", "BODY", "BODY_ATTACHMENTS"])
195
+ unless validator.valid?(content_selector)
196
+ fail ArgumentError, "invalid value for \"content_selector\", must be one of #{validator.allowable_values}."
197
+ end
198
+ @content_selector = content_selector
199
+ end
200
+
201
+ # Custom attribute writer method checking allowed values (enum).
202
+ # @param [Object] trigger_selector Object to be assigned
203
+ def trigger_selector=(trigger_selector)
204
+ validator = EnumAttributeValidator.new('String', ["PER_MESSAGE", "PER_ATTACHMENT"])
205
+ unless validator.valid?(trigger_selector)
206
+ fail ArgumentError, "invalid value for \"trigger_selector\", must be one of #{validator.allowable_values}."
207
+ end
208
+ @trigger_selector = trigger_selector
209
+ end
210
+
211
+ # Checks equality by comparing each attribute.
212
+ # @param [Object] Object to be compared
213
+ def ==(o)
214
+ return true if self.equal?(o)
215
+ self.class == o.class &&
216
+ user_id == o.user_id &&
217
+ ai_transform_id == o.ai_transform_id &&
218
+ entity_id == o.entity_id &&
219
+ entity_type == o.entity_type &&
220
+ content_selector == o.content_selector &&
221
+ trigger_selector == o.trigger_selector &&
222
+ name == o.name &&
223
+ id == o.id
224
+ end
225
+
226
+ # @see the `==` method
227
+ # @param [Object] Object to be compared
228
+ def eql?(o)
229
+ self == o
230
+ end
231
+
232
+ # Calculates hash code according to all attributes.
233
+ # @return [Integer] Hash code
234
+ def hash
235
+ [user_id, ai_transform_id, entity_id, entity_type, content_selector, trigger_selector, name, id].hash
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def self.build_from_hash(attributes)
242
+ new.build_from_hash(attributes)
243
+ end
244
+
245
+ # Builds the object from hash
246
+ # @param [Hash] attributes Model attributes in the form of hash
247
+ # @return [Object] Returns the model itself
248
+ def build_from_hash(attributes)
249
+ return nil unless attributes.is_a?(Hash)
250
+ self.class.openapi_types.each_pair do |key, type|
251
+ if type =~ /\AArray<(.*)>/i
252
+ # check to ensure the input is an array given that the attribute
253
+ # is documented as an array but the input is not
254
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
255
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
256
+ end
257
+ elsif !attributes[self.class.attribute_map[key]].nil?
258
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
259
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
260
+ end
261
+
262
+ self
263
+ end
264
+
265
+ # Deserializes the data based on type
266
+ # @param string type Data type
267
+ # @param string value Value to be deserialized
268
+ # @return [Object] Deserialized data
269
+ def _deserialize(type, value)
270
+ case type.to_sym
271
+ when :DateTime
272
+ DateTime.parse(value)
273
+ when :Date
274
+ Date.parse(value)
275
+ when :String
276
+ value.to_s
277
+ when :Integer
278
+ value.to_i
279
+ when :Float
280
+ value.to_f
281
+ when :Boolean
282
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
283
+ true
284
+ else
285
+ false
286
+ end
287
+ when :Object
288
+ # generic object (usually a Hash), return directly
289
+ value
290
+ when /\AArray<(?<inner_type>.+)>\z/
291
+ inner_type = Regexp.last_match[:inner_type]
292
+ value.map { |v| _deserialize(inner_type, v) }
293
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
294
+ k_type = Regexp.last_match[:k_type]
295
+ v_type = Regexp.last_match[:v_type]
296
+ {}.tap do |hash|
297
+ value.each do |k, v|
298
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
299
+ end
300
+ end
301
+ else # model
302
+ MailSlurpClient.const_get(type).build_from_hash(value)
303
+ end
304
+ end
305
+
306
+ # Returns the string representation of the object
307
+ # @return [String] String presentation of the object
308
+ def to_s
309
+ to_hash.to_s
310
+ end
311
+
312
+ # to_body is an alias to to_hash (backward compatibility)
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_body
315
+ to_hash
316
+ end
317
+
318
+ # Returns the object in the form of hash
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_hash
321
+ hash = {}
322
+ self.class.attribute_map.each_pair do |attr, param|
323
+ value = self.send(attr)
324
+ if value.nil?
325
+ is_nullable = self.class.openapi_nullable.include?(attr)
326
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
327
+ end
328
+
329
+ hash[param] = _to_hash(value)
330
+ end
331
+ hash
332
+ end
333
+
334
+ # Outputs non-array value in the form of hash
335
+ # For object, use to_hash. Otherwise, just return the value
336
+ # @param [Object] value Any valid value
337
+ # @return [Hash] Returns the value in the form of hash
338
+ def _to_hash(value)
339
+ if value.is_a?(Array)
340
+ value.compact.map { |v| _to_hash(v) }
341
+ elsif value.is_a?(Hash)
342
+ {}.tap do |hash|
343
+ value.each { |k, v| hash[k] = _to_hash(v) }
344
+ end
345
+ elsif value.respond_to? :to_hash
346
+ value.to_hash
347
+ else
348
+ value
349
+ end
350
+ end
351
+ end
352
+ end