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
@@ -154,41 +154,35 @@ module MailSlurpClient
154
154
 
155
155
  # Wait for Nth missed email
156
156
  # Wait for 0 based index missed email
157
- # @param inbox_id [String] Optional inbox ID filter
158
- # @param timeout [Integer] Optional timeout milliseconds
159
157
  # @param [Hash] opts the optional parameters
158
+ # @option opts [String] :inbox_id Optional inbox ID filter
160
159
  # @option opts [Integer] :index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1
160
+ # @option opts [Integer] :timeout Optional timeout milliseconds
161
161
  # @return [MissedEmail]
162
- def wait_for_nth_missed_email(inbox_id, timeout, opts = {})
163
- data, _status_code, _headers = wait_for_nth_missed_email_with_http_info(inbox_id, timeout, opts)
162
+ def wait_for_nth_missed_email(opts = {})
163
+ data, _status_code, _headers = wait_for_nth_missed_email_with_http_info(opts)
164
164
  data
165
165
  end
166
166
 
167
167
  # Wait for Nth missed email
168
168
  # Wait for 0 based index missed email
169
- # @param inbox_id [String] Optional inbox ID filter
170
- # @param timeout [Integer] Optional timeout milliseconds
171
169
  # @param [Hash] opts the optional parameters
170
+ # @option opts [String] :inbox_id Optional inbox ID filter
172
171
  # @option opts [Integer] :index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1
172
+ # @option opts [Integer] :timeout Optional timeout milliseconds
173
173
  # @return [Array<(MissedEmail, Integer, Hash)>] MissedEmail data, response status code and response headers
174
- def wait_for_nth_missed_email_with_http_info(inbox_id, timeout, opts = {})
174
+ def wait_for_nth_missed_email_with_http_info(opts = {})
175
175
  if @api_client.config.debugging
176
176
  @api_client.config.logger.debug 'Calling API: MissedEmailControllerApi.wait_for_nth_missed_email ...'
177
177
  end
178
- # verify the required parameter 'inbox_id' is set
179
- if @api_client.config.client_side_validation && inbox_id.nil?
180
- fail ArgumentError, "Missing the required parameter 'inbox_id' when calling MissedEmailControllerApi.wait_for_nth_missed_email"
181
- end
182
- # verify the required parameter 'timeout' is set
183
- if @api_client.config.client_side_validation && timeout.nil?
184
- fail ArgumentError, "Missing the required parameter 'timeout' when calling MissedEmailControllerApi.wait_for_nth_missed_email"
185
- end
186
178
  # resource path
187
- local_var_path = '/missed-emails/waitForNthMissedEmail'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s)).sub('{' + 'timeout' + '}', CGI.escape(timeout.to_s))
179
+ local_var_path = '/missed-emails/waitForNthMissedEmail'
188
180
 
189
181
  # query parameters
190
182
  query_params = opts[:query_params] || {}
183
+ query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
191
184
  query_params[:'index'] = opts[:'index'] if !opts[:'index'].nil?
185
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
192
186
 
193
187
  # header parameters
194
188
  header_params = opts[:header_params] || {}
@@ -19,6 +19,76 @@ module MailSlurpClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Get all sent email tracking pixels in paginated form
23
+ # @param [Hash] opts the optional parameters
24
+ # @option opts [Integer] :page Optional page index in sent email tracking pixel list pagination (default to 0)
25
+ # @option opts [String] :search_filter Optional search filter
26
+ # @option opts [Integer] :size Optional page size in sent email tracking pixel list pagination (default to 20)
27
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
28
+ # @return [PageTrackingPixelProjection]
29
+ def get_all_sent_tracking_pixels(opts = {})
30
+ data, _status_code, _headers = get_all_sent_tracking_pixels_with_http_info(opts)
31
+ data
32
+ end
33
+
34
+ # Get all sent email tracking pixels in paginated form
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [Integer] :page Optional page index in sent email tracking pixel list pagination
37
+ # @option opts [String] :search_filter Optional search filter
38
+ # @option opts [Integer] :size Optional page size in sent email tracking pixel list pagination
39
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
40
+ # @return [Array<(PageTrackingPixelProjection, Integer, Hash)>] PageTrackingPixelProjection data, response status code and response headers
41
+ def get_all_sent_tracking_pixels_with_http_info(opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: SentEmailsControllerApi.get_all_sent_tracking_pixels ...'
44
+ end
45
+ allowable_values = ["ASC", "DESC"]
46
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
47
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
48
+ end
49
+ # resource path
50
+ local_var_path = '/sent/tracking-pixels'
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
55
+ query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
56
+ query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
57
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
58
+
59
+ # header parameters
60
+ header_params = opts[:header_params] || {}
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:body]
69
+
70
+ # return_type
71
+ return_type = opts[:return_type] || 'PageTrackingPixelProjection'
72
+
73
+ # auth_names
74
+ auth_names = opts[:auth_names] || ['API_KEY']
75
+
76
+ new_options = opts.merge(
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: SentEmailsControllerApi#get_all_sent_tracking_pixels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
22
92
  # Get sent email receipt
23
93
  # @param id [String] id
24
94
  # @param [Hash] opts the optional parameters
@@ -79,6 +149,82 @@ module MailSlurpClient
79
149
  return data, status_code, headers
80
150
  end
81
151
 
152
+ # Get all tracking pixels for a sent email in paginated form
153
+ # @param id [String] id
154
+ # @param [Hash] opts the optional parameters
155
+ # @option opts [Integer] :page Optional page index in sent email tracking pixel list pagination (default to 0)
156
+ # @option opts [String] :search_filter Optional search filter
157
+ # @option opts [Integer] :size Optional page size in sent email tracking pixel list pagination (default to 20)
158
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
159
+ # @return [PageTrackingPixelProjection]
160
+ def get_sent_email_tracking_pixels(id, opts = {})
161
+ data, _status_code, _headers = get_sent_email_tracking_pixels_with_http_info(id, opts)
162
+ data
163
+ end
164
+
165
+ # Get all tracking pixels for a sent email in paginated form
166
+ # @param id [String] id
167
+ # @param [Hash] opts the optional parameters
168
+ # @option opts [Integer] :page Optional page index in sent email tracking pixel list pagination
169
+ # @option opts [String] :search_filter Optional search filter
170
+ # @option opts [Integer] :size Optional page size in sent email tracking pixel list pagination
171
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
172
+ # @return [Array<(PageTrackingPixelProjection, Integer, Hash)>] PageTrackingPixelProjection data, response status code and response headers
173
+ def get_sent_email_tracking_pixels_with_http_info(id, opts = {})
174
+ if @api_client.config.debugging
175
+ @api_client.config.logger.debug 'Calling API: SentEmailsControllerApi.get_sent_email_tracking_pixels ...'
176
+ end
177
+ # verify the required parameter 'id' is set
178
+ if @api_client.config.client_side_validation && id.nil?
179
+ fail ArgumentError, "Missing the required parameter 'id' when calling SentEmailsControllerApi.get_sent_email_tracking_pixels"
180
+ end
181
+ allowable_values = ["ASC", "DESC"]
182
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
183
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
184
+ end
185
+ # resource path
186
+ local_var_path = '/sent/{id}/tracking-pixels'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
187
+
188
+ # query parameters
189
+ query_params = opts[:query_params] || {}
190
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
191
+ query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
192
+ query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
193
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
194
+
195
+ # header parameters
196
+ header_params = opts[:header_params] || {}
197
+ # HTTP header 'Accept' (if needed)
198
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
199
+
200
+ # form parameters
201
+ form_params = opts[:form_params] || {}
202
+
203
+ # http body (model)
204
+ post_body = opts[:body]
205
+
206
+ # return_type
207
+ return_type = opts[:return_type] || 'PageTrackingPixelProjection'
208
+
209
+ # auth_names
210
+ auth_names = opts[:auth_names] || ['API_KEY']
211
+
212
+ new_options = opts.merge(
213
+ :header_params => header_params,
214
+ :query_params => query_params,
215
+ :form_params => form_params,
216
+ :body => post_body,
217
+ :auth_names => auth_names,
218
+ :return_type => return_type
219
+ )
220
+
221
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
222
+ if @api_client.config.debugging
223
+ @api_client.config.logger.debug "API called: SentEmailsControllerApi#get_sent_email_tracking_pixels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
224
+ end
225
+ return data, status_code, headers
226
+ end
227
+
82
228
  # Get all sent emails in paginated form
83
229
  # @param [Hash] opts the optional parameters
84
230
  # @option opts [String] :inbox_id Optional inboxId to filter sender of sent emails by
@@ -155,9 +301,9 @@ module MailSlurpClient
155
301
  # Get all sent organization emails in paginated form
156
302
  # @param [Hash] opts the optional parameters
157
303
  # @option opts [String] :inbox_id Optional inboxId to filter sender of sent emails by
158
- # @option opts [Integer] :page Optional page index in inbox sent email list pagination (default to 0)
304
+ # @option opts [Integer] :page Optional page index in sent email list pagination (default to 0)
159
305
  # @option opts [String] :search_filter Optional search filter
160
- # @option opts [Integer] :size Optional page size in inbox sent email list pagination (default to 20)
306
+ # @option opts [Integer] :size Optional page size in sent email list pagination (default to 20)
161
307
  # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
162
308
  # @return [PageSentEmailProjection]
163
309
  def get_sent_organization_emails(opts = {})
@@ -168,9 +314,9 @@ module MailSlurpClient
168
314
  # Get all sent organization emails in paginated form
169
315
  # @param [Hash] opts the optional parameters
170
316
  # @option opts [String] :inbox_id Optional inboxId to filter sender of sent emails by
171
- # @option opts [Integer] :page Optional page index in inbox sent email list pagination
317
+ # @option opts [Integer] :page Optional page index in sent email list pagination
172
318
  # @option opts [String] :search_filter Optional search filter
173
- # @option opts [Integer] :size Optional page size in inbox sent email list pagination
319
+ # @option opts [Integer] :size Optional page size in sent email list pagination
174
320
  # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
175
321
  # @return [Array<(PageSentEmailProjection, Integer, Hash)>] PageSentEmailProjection data, response status code and response headers
176
322
  def get_sent_organization_emails_with_http_info(opts = {})
@@ -20,7 +20,7 @@ module MailSlurpClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # Create tracking pixel
23
- # Create a tracking pixel
23
+ # Create a tracking pixel. A tracking pixel is an image that can be embedded in an email. When the email is viewed and the image is seen MailSlurp will mark the pixel as seen. Use tracking pixels to monitor email open events. You can receive open notifications via webhook or by fetching the pixel.
24
24
  # @param create_tracking_pixel_options [CreateTrackingPixelOptions] createTrackingPixelOptions
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [TrackingPixelDto]
@@ -30,7 +30,7 @@ module MailSlurpClient
30
30
  end
31
31
 
32
32
  # Create tracking pixel
33
- # Create a tracking pixel
33
+ # Create a tracking pixel. A tracking pixel is an image that can be embedded in an email. When the email is viewed and the image is seen MailSlurp will mark the pixel as seen. Use tracking pixels to monitor email open events. You can receive open notifications via webhook or by fetching the pixel.
34
34
  # @param create_tracking_pixel_options [CreateTrackingPixelOptions] createTrackingPixelOptions
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(TrackingPixelDto, Integer, Hash)>] TrackingPixelDto data, response status code and response headers
@@ -87,6 +87,7 @@ module MailSlurpClient
87
87
  # List tracking pixels in paginated form
88
88
  # @param [Hash] opts the optional parameters
89
89
  # @option opts [Integer] :page Optional page index in list pagination (default to 0)
90
+ # @option opts [String] :search_filter Optional search filter
90
91
  # @option opts [Integer] :size Optional page size in list pagination (default to 20)
91
92
  # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
92
93
  # @return [PageTrackingPixelProjection]
@@ -99,6 +100,7 @@ module MailSlurpClient
99
100
  # List tracking pixels in paginated form
100
101
  # @param [Hash] opts the optional parameters
101
102
  # @option opts [Integer] :page Optional page index in list pagination
103
+ # @option opts [String] :search_filter Optional search filter
102
104
  # @option opts [Integer] :size Optional page size in list pagination
103
105
  # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
104
106
  # @return [Array<(PageTrackingPixelProjection, Integer, Hash)>] PageTrackingPixelProjection data, response status code and response headers
@@ -116,6 +118,7 @@ module MailSlurpClient
116
118
  # query parameters
117
119
  query_params = opts[:query_params] || {}
118
120
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
121
+ query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
119
122
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
120
123
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
121
124
 
@@ -388,7 +388,7 @@ module MailSlurpClient
388
388
  if @api_client.config.debugging
389
389
  @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload ...'
390
390
  end
391
- allowable_values = ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"]
391
+ allowable_values = ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"]
392
392
  if @api_client.config.client_side_validation && opts[:'event_name'] && !allowable_values.include?(opts[:'event_name'])
393
393
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{allowable_values}"
394
394
  end
@@ -432,6 +432,60 @@ module MailSlurpClient
432
432
  return data, status_code, headers
433
433
  end
434
434
 
435
+ # Get webhook test payload for email opened event
436
+ # @param [Hash] opts the optional parameters
437
+ # @return [WebhookEmailOpenedPayload]
438
+ def get_test_webhook_payload_email_opened(opts = {})
439
+ data, _status_code, _headers = get_test_webhook_payload_email_opened_with_http_info(opts)
440
+ data
441
+ end
442
+
443
+ # Get webhook test payload for email opened event
444
+ # @param [Hash] opts the optional parameters
445
+ # @return [Array<(WebhookEmailOpenedPayload, Integer, Hash)>] WebhookEmailOpenedPayload data, response status code and response headers
446
+ def get_test_webhook_payload_email_opened_with_http_info(opts = {})
447
+ if @api_client.config.debugging
448
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_email_opened ...'
449
+ end
450
+ # resource path
451
+ local_var_path = '/webhooks/test/email-opened-payload'
452
+
453
+ # query parameters
454
+ query_params = opts[:query_params] || {}
455
+
456
+ # header parameters
457
+ header_params = opts[:header_params] || {}
458
+ # HTTP header 'Accept' (if needed)
459
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
460
+
461
+ # form parameters
462
+ form_params = opts[:form_params] || {}
463
+
464
+ # http body (model)
465
+ post_body = opts[:body]
466
+
467
+ # return_type
468
+ return_type = opts[:return_type] || 'WebhookEmailOpenedPayload'
469
+
470
+ # auth_names
471
+ auth_names = opts[:auth_names] || ['API_KEY']
472
+
473
+ new_options = opts.merge(
474
+ :header_params => header_params,
475
+ :query_params => query_params,
476
+ :form_params => form_params,
477
+ :body => post_body,
478
+ :auth_names => auth_names,
479
+ :return_type => return_type
480
+ )
481
+
482
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
483
+ if @api_client.config.debugging
484
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_email_opened\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
485
+ end
486
+ return data, status_code, headers
487
+ end
488
+
435
489
  # Get webhook test payload for new attachment event
436
490
  # @param [Hash] opts the optional parameters
437
491
  # @return [WebhookNewAttachmentPayload]
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Abstract webhook payload. Use the correct payload type for your webhook event type in order to access all the specific properties for that event. See the `NEW_EMAIL`,`NEW_CONTACT` and `NEW_ATTACHMENT` payloads for the properties available for those events.
16
+ # Abstract webhook payload. Use the correct payload type for your webhook event type in order to access all the specific properties for that event. See the `NEW_EMAIL`,`NEW_CONTACT`, `NEW_ATTACHMENT` and `EMAIL_OPENED` payloads for the properties available for those events.
17
17
  class AbstractWebhookPayload
18
18
  attr_accessor :event_name
19
19
 
@@ -126,7 +126,7 @@ module MailSlurpClient
126
126
  # @return true if the model is valid
127
127
  def valid?
128
128
  return false if @event_name.nil?
129
- event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
129
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
130
130
  return false unless event_name_validator.valid?(@event_name)
131
131
  return false if @message_id.nil?
132
132
  return false if @webhook_id.nil?
@@ -136,7 +136,7 @@ module MailSlurpClient
136
136
  # Custom attribute writer method checking allowed values (enum).
137
137
  # @param [Object] event_name Object to be assigned
138
138
  def event_name=(event_name)
139
- validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
139
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
140
140
  unless validator.valid?(event_name)
141
141
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
142
142
  end
@@ -0,0 +1,275 @@
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
+ class CreateInboxForwarderOptions
17
+ attr_accessor :field
18
+
19
+ attr_accessor :match
20
+
21
+ attr_accessor :forward_to_recipients
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'field' => :'field',
49
+ :'match' => :'match',
50
+ :'forward_to_recipients' => :'forwardToRecipients'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'field' => :'String',
58
+ :'match' => :'String',
59
+ :'forward_to_recipients' => :'Array<String>'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateInboxForwarderOptions` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateInboxForwarderOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'field')
85
+ self.field = attributes[:'field']
86
+ end
87
+
88
+ if attributes.key?(:'match')
89
+ self.match = attributes[:'match']
90
+ end
91
+
92
+ if attributes.key?(:'forward_to_recipients')
93
+ if (value = attributes[:'forward_to_recipients']).is_a?(Array)
94
+ self.forward_to_recipients = value
95
+ end
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @field.nil?
104
+ invalid_properties.push('invalid value for "field", field cannot be nil.')
105
+ end
106
+
107
+ if @match.nil?
108
+ invalid_properties.push('invalid value for "match", match cannot be nil.')
109
+ end
110
+
111
+ if @forward_to_recipients.nil?
112
+ invalid_properties.push('invalid value for "forward_to_recipients", forward_to_recipients cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @field.nil?
122
+ field_validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS"])
123
+ return false unless field_validator.valid?(@field)
124
+ return false if @match.nil?
125
+ return false if @forward_to_recipients.nil?
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ # @param [Object] field Object to be assigned
131
+ def field=(field)
132
+ validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS"])
133
+ unless validator.valid?(field)
134
+ fail ArgumentError, "invalid value for \"field\", must be one of #{validator.allowable_values}."
135
+ end
136
+ @field = field
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ field == o.field &&
145
+ match == o.match &&
146
+ forward_to_recipients == o.forward_to_recipients
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [field, match, forward_to_recipients].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ new.build_from_hash(attributes)
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ self.class.openapi_types.each_pair do |key, type|
174
+ if type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
178
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
179
+ end
180
+ elsif !attributes[self.class.attribute_map[key]].nil?
181
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
183
+ end
184
+
185
+ self
186
+ end
187
+
188
+ # Deserializes the data based on type
189
+ # @param string type Data type
190
+ # @param string value Value to be deserialized
191
+ # @return [Object] Deserialized data
192
+ def _deserialize(type, value)
193
+ case type.to_sym
194
+ when :DateTime
195
+ DateTime.parse(value)
196
+ when :Date
197
+ Date.parse(value)
198
+ when :String
199
+ value.to_s
200
+ when :Integer
201
+ value.to_i
202
+ when :Float
203
+ value.to_f
204
+ when :Boolean
205
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
206
+ true
207
+ else
208
+ false
209
+ end
210
+ when :Object
211
+ # generic object (usually a Hash), return directly
212
+ value
213
+ when /\AArray<(?<inner_type>.+)>\z/
214
+ inner_type = Regexp.last_match[:inner_type]
215
+ value.map { |v| _deserialize(inner_type, v) }
216
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
217
+ k_type = Regexp.last_match[:k_type]
218
+ v_type = Regexp.last_match[:v_type]
219
+ {}.tap do |hash|
220
+ value.each do |k, v|
221
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
222
+ end
223
+ end
224
+ else # model
225
+ MailSlurpClient.const_get(type).build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+ end
275
+ end