mailslurp_client 12.6.0 → 12.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client.rb +8 -0
  3. data/lib/mailslurp_client/api/email_controller_api.rb +7 -5
  4. data/lib/mailslurp_client/api/inbox_controller_api.rb +96 -14
  5. data/lib/mailslurp_client/api/inbox_forwarder_controller_api.rb +548 -0
  6. data/lib/mailslurp_client/api/missed_email_controller_api.rb +10 -16
  7. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +150 -4
  8. data/lib/mailslurp_client/api/tracking_controller_api.rb +5 -2
  9. data/lib/mailslurp_client/api/webhook_controller_api.rb +55 -1
  10. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +3 -3
  11. data/lib/mailslurp_client/models/create_inbox_forwarder_options.rb +275 -0
  12. data/lib/mailslurp_client/models/create_webhook_options.rb +3 -3
  13. data/lib/mailslurp_client/models/domain_preview.rb +66 -4
  14. data/lib/mailslurp_client/models/email.rb +11 -1
  15. data/lib/mailslurp_client/models/email_projection.rb +10 -1
  16. data/lib/mailslurp_client/models/inbox_forwarder_dto.rb +317 -0
  17. data/lib/mailslurp_client/models/inbox_forwarder_test_options.rb +211 -0
  18. data/lib/mailslurp_client/models/inbox_forwarder_test_result.rb +227 -0
  19. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +299 -0
  20. data/lib/mailslurp_client/models/test_new_inbox_forwarder_options.rb +225 -0
  21. data/lib/mailslurp_client/models/tracking_pixel_dto.rb +42 -1
  22. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +37 -1
  23. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  24. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +322 -0
  25. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  26. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
  27. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  28. data/lib/mailslurp_client/models/webhook_projection.rb +44 -1
  29. data/lib/mailslurp_client/models/webhook_result_entity.rb +24 -3
  30. data/lib/mailslurp_client/version.rb +1 -1
  31. metadata +10 -2
@@ -0,0 +1,322 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
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
+ # EMAIL_OPENED webhook payload. Sent to your webhook url endpoint via HTTP POST when an email containing a tracking pixel is opened and the pixel image is loaded by a reader.
17
+ class WebhookEmailOpenedPayload
18
+ # Date time of event creation
19
+ attr_accessor :created_at
20
+
21
+ # Name of the event type webhook is being triggered for.
22
+ attr_accessor :event_name
23
+
24
+ # Id of the inbox that received an email
25
+ attr_accessor :inbox_id
26
+
27
+ # Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
28
+ attr_accessor :message_id
29
+
30
+ # ID of the tracking pixel
31
+ attr_accessor :pixel_id
32
+
33
+ # Email address for the recipient of the tracking pixel
34
+ attr_accessor :recipient
35
+
36
+ # ID of sent email
37
+ attr_accessor :sent_email_id
38
+
39
+ # ID of webhook entity being triggered
40
+ attr_accessor :webhook_id
41
+
42
+ # Name of the webhook being triggered
43
+ attr_accessor :webhook_name
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'created_at' => :'createdAt',
71
+ :'event_name' => :'eventName',
72
+ :'inbox_id' => :'inboxId',
73
+ :'message_id' => :'messageId',
74
+ :'pixel_id' => :'pixelId',
75
+ :'recipient' => :'recipient',
76
+ :'sent_email_id' => :'sentEmailId',
77
+ :'webhook_id' => :'webhookId',
78
+ :'webhook_name' => :'webhookName'
79
+ }
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'created_at' => :'DateTime',
86
+ :'event_name' => :'String',
87
+ :'inbox_id' => :'String',
88
+ :'message_id' => :'String',
89
+ :'pixel_id' => :'String',
90
+ :'recipient' => :'String',
91
+ :'sent_email_id' => :'String',
92
+ :'webhook_id' => :'String',
93
+ :'webhook_name' => :'String'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookEmailOpenedPayload` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookEmailOpenedPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'created_at')
119
+ self.created_at = attributes[:'created_at']
120
+ end
121
+
122
+ if attributes.key?(:'event_name')
123
+ self.event_name = attributes[:'event_name']
124
+ end
125
+
126
+ if attributes.key?(:'inbox_id')
127
+ self.inbox_id = attributes[:'inbox_id']
128
+ end
129
+
130
+ if attributes.key?(:'message_id')
131
+ self.message_id = attributes[:'message_id']
132
+ end
133
+
134
+ if attributes.key?(:'pixel_id')
135
+ self.pixel_id = attributes[:'pixel_id']
136
+ end
137
+
138
+ if attributes.key?(:'recipient')
139
+ self.recipient = attributes[:'recipient']
140
+ end
141
+
142
+ if attributes.key?(:'sent_email_id')
143
+ self.sent_email_id = attributes[:'sent_email_id']
144
+ end
145
+
146
+ if attributes.key?(:'webhook_id')
147
+ self.webhook_id = attributes[:'webhook_id']
148
+ end
149
+
150
+ if attributes.key?(:'webhook_name')
151
+ self.webhook_name = attributes[:'webhook_name']
152
+ end
153
+ end
154
+
155
+ # Show invalid properties with the reasons. Usually used together with valid?
156
+ # @return Array for valid properties with the reasons
157
+ def list_invalid_properties
158
+ invalid_properties = Array.new
159
+ invalid_properties
160
+ end
161
+
162
+ # Check to see if the all the properties in the model are valid
163
+ # @return true if the model is valid
164
+ def valid?
165
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
166
+ return false unless event_name_validator.valid?(@event_name)
167
+ true
168
+ end
169
+
170
+ # Custom attribute writer method checking allowed values (enum).
171
+ # @param [Object] event_name Object to be assigned
172
+ def event_name=(event_name)
173
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
174
+ unless validator.valid?(event_name)
175
+ fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
176
+ end
177
+ @event_name = event_name
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if self.equal?(o)
184
+ self.class == o.class &&
185
+ created_at == o.created_at &&
186
+ event_name == o.event_name &&
187
+ inbox_id == o.inbox_id &&
188
+ message_id == o.message_id &&
189
+ pixel_id == o.pixel_id &&
190
+ recipient == o.recipient &&
191
+ sent_email_id == o.sent_email_id &&
192
+ webhook_id == o.webhook_id &&
193
+ webhook_name == o.webhook_name
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [created_at, event_name, inbox_id, message_id, pixel_id, recipient, sent_email_id, webhook_id, webhook_name].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ new.build_from_hash(attributes)
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ self.class.openapi_types.each_pair do |key, type|
221
+ if type =~ /\AArray<(.*)>/i
222
+ # check to ensure the input is an array given that the attribute
223
+ # is documented as an array but the input is not
224
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
225
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
226
+ end
227
+ elsif !attributes[self.class.attribute_map[key]].nil?
228
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
229
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
230
+ end
231
+
232
+ self
233
+ end
234
+
235
+ # Deserializes the data based on type
236
+ # @param string type Data type
237
+ # @param string value Value to be deserialized
238
+ # @return [Object] Deserialized data
239
+ def _deserialize(type, value)
240
+ case type.to_sym
241
+ when :DateTime
242
+ DateTime.parse(value)
243
+ when :Date
244
+ Date.parse(value)
245
+ when :String
246
+ value.to_s
247
+ when :Integer
248
+ value.to_i
249
+ when :Float
250
+ value.to_f
251
+ when :Boolean
252
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
253
+ true
254
+ else
255
+ false
256
+ end
257
+ when :Object
258
+ # generic object (usually a Hash), return directly
259
+ value
260
+ when /\AArray<(?<inner_type>.+)>\z/
261
+ inner_type = Regexp.last_match[:inner_type]
262
+ value.map { |v| _deserialize(inner_type, v) }
263
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
264
+ k_type = Regexp.last_match[:k_type]
265
+ v_type = Regexp.last_match[:v_type]
266
+ {}.tap do |hash|
267
+ value.each do |k, v|
268
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
269
+ end
270
+ end
271
+ else # model
272
+ MailSlurpClient.const_get(type).build_from_hash(value)
273
+ end
274
+ end
275
+
276
+ # Returns the string representation of the object
277
+ # @return [String] String presentation of the object
278
+ def to_s
279
+ to_hash.to_s
280
+ end
281
+
282
+ # to_body is an alias to to_hash (backward compatibility)
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_body
285
+ to_hash
286
+ end
287
+
288
+ # Returns the object in the form of hash
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_hash
291
+ hash = {}
292
+ self.class.attribute_map.each_pair do |attr, param|
293
+ value = self.send(attr)
294
+ if value.nil?
295
+ is_nullable = self.class.openapi_nullable.include?(attr)
296
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
297
+ end
298
+
299
+ hash[param] = _to_hash(value)
300
+ end
301
+ hash
302
+ end
303
+
304
+ # Outputs non-array value in the form of hash
305
+ # For object, use to_hash. Otherwise, just return the value
306
+ # @param [Object] value Any valid value
307
+ # @return [Hash] Returns the value in the form of hash
308
+ def _to_hash(value)
309
+ if value.is_a?(Array)
310
+ value.compact.map { |v| _to_hash(v) }
311
+ elsif value.is_a?(Hash)
312
+ {}.tap do |hash|
313
+ value.each { |k, v| hash[k] = _to_hash(v) }
314
+ end
315
+ elsif value.respond_to? :to_hash
316
+ value.to_hash
317
+ else
318
+ value
319
+ end
320
+ end
321
+ end
322
+ end
@@ -153,7 +153,7 @@ module MailSlurpClient
153
153
  # Check to see if the all the properties in the model are valid
154
154
  # @return true if the model is valid
155
155
  def valid?
156
- event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
156
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
157
157
  return false unless event_name_validator.valid?(@event_name)
158
158
  true
159
159
  end
@@ -161,7 +161,7 @@ module MailSlurpClient
161
161
  # Custom attribute writer method checking allowed values (enum).
162
162
  # @param [Object] event_name Object to be assigned
163
163
  def event_name=(event_name)
164
- validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
164
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
165
165
  unless validator.valid?(event_name)
166
166
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
167
167
  end
@@ -228,7 +228,7 @@ module MailSlurpClient
228
228
  return false if @contact_id.nil?
229
229
  return false if @created_at.nil?
230
230
  return false if @email_addresses.nil?
231
- event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
231
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
232
232
  return false unless event_name_validator.valid?(@event_name)
233
233
  return false if @tags.nil?
234
234
  true
@@ -237,7 +237,7 @@ module MailSlurpClient
237
237
  # Custom attribute writer method checking allowed values (enum).
238
238
  # @param [Object] event_name Object to be assigned
239
239
  def event_name=(event_name)
240
- validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
240
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
241
241
  unless validator.valid?(event_name)
242
242
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
243
243
  end
@@ -206,7 +206,7 @@ module MailSlurpClient
206
206
  # Check to see if the all the properties in the model are valid
207
207
  # @return true if the model is valid
208
208
  def valid?
209
- event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
209
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
210
210
  return false unless event_name_validator.valid?(@event_name)
211
211
  true
212
212
  end
@@ -214,7 +214,7 @@ module MailSlurpClient
214
214
  # Custom attribute writer method checking allowed values (enum).
215
215
  # @param [Object] event_name Object to be assigned
216
216
  def event_name=(event_name)
217
- validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
217
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
218
218
  unless validator.valid?(event_name)
219
219
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
220
220
  end
@@ -17,6 +17,8 @@ module MailSlurpClient
17
17
  class WebhookProjection
18
18
  attr_accessor :created_at
19
19
 
20
+ attr_accessor :event_name
21
+
20
22
  attr_accessor :id
21
23
 
22
24
  attr_accessor :inbox_id
@@ -27,10 +29,33 @@ module MailSlurpClient
27
29
 
28
30
  attr_accessor :url
29
31
 
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
30
54
  # Attribute mapping from ruby-style variable name to JSON key.
31
55
  def self.attribute_map
32
56
  {
33
57
  :'created_at' => :'createdAt',
58
+ :'event_name' => :'eventName',
34
59
  :'id' => :'id',
35
60
  :'inbox_id' => :'inboxId',
36
61
  :'name' => :'name',
@@ -43,6 +68,7 @@ module MailSlurpClient
43
68
  def self.openapi_types
44
69
  {
45
70
  :'created_at' => :'DateTime',
71
+ :'event_name' => :'String',
46
72
  :'id' => :'String',
47
73
  :'inbox_id' => :'String',
48
74
  :'name' => :'String',
@@ -76,6 +102,10 @@ module MailSlurpClient
76
102
  self.created_at = attributes[:'created_at']
77
103
  end
78
104
 
105
+ if attributes.key?(:'event_name')
106
+ self.event_name = attributes[:'event_name']
107
+ end
108
+
79
109
  if attributes.key?(:'id')
80
110
  self.id = attributes[:'id']
81
111
  end
@@ -128,6 +158,8 @@ module MailSlurpClient
128
158
  # @return true if the model is valid
129
159
  def valid?
130
160
  return false if @created_at.nil?
161
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
162
+ return false unless event_name_validator.valid?(@event_name)
131
163
  return false if @id.nil?
132
164
  return false if @inbox_id.nil?
133
165
  return false if @updated_at.nil?
@@ -135,12 +167,23 @@ module MailSlurpClient
135
167
  true
136
168
  end
137
169
 
170
+ # Custom attribute writer method checking allowed values (enum).
171
+ # @param [Object] event_name Object to be assigned
172
+ def event_name=(event_name)
173
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
174
+ unless validator.valid?(event_name)
175
+ fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
176
+ end
177
+ @event_name = event_name
178
+ end
179
+
138
180
  # Checks equality by comparing each attribute.
139
181
  # @param [Object] Object to be compared
140
182
  def ==(o)
141
183
  return true if self.equal?(o)
142
184
  self.class == o.class &&
143
185
  created_at == o.created_at &&
186
+ event_name == o.event_name &&
144
187
  id == o.id &&
145
188
  inbox_id == o.inbox_id &&
146
189
  name == o.name &&
@@ -157,7 +200,7 @@ module MailSlurpClient
157
200
  # Calculates hash code according to all attributes.
158
201
  # @return [Integer] Hash code
159
202
  def hash
160
- [created_at, id, inbox_id, name, updated_at, url].hash
203
+ [created_at, event_name, id, inbox_id, name, updated_at, url].hash
161
204
  end
162
205
 
163
206
  # Builds the object from hash