Class: MailSlurpClient::WaitForControllerApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/api/wait_for_controller_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WaitForControllerApi

Returns a new instance of WaitForControllerApi.



19
20
21
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#wait_for(wait_for_conditions, opts = {}) ⇒ Array<EmailPreview>

Wait for an email to match the provided filter conditions such as subject contains keyword. Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met

Parameters:

  • wait_for_conditions (WaitForConditions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 27

def wait_for(wait_for_conditions, opts = {})
  data, _status_code, _headers = wait_for_with_http_info(wait_for_conditions, opts)
  data
end

#wait_for_email_count(inbox_id, count, opts = {}) ⇒ Array<EmailPreview>

Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.

Parameters:

  • inbox_id (String)

    Id of the inbox we are fetching emails from

  • count (Integer)

    Number of emails to wait for. Must be greater that 1

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only (default to false)

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:



98
99
100
101
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 98

def wait_for_email_count(inbox_id, count, opts = {})
  data, _status_code, _headers = wait_for_email_count_with_http_info(inbox_id, count, opts)
  data
end

#wait_for_email_count_with_http_info(inbox_id, count, opts = {}) ⇒ Array<(Array<EmailPreview>, Integer, Hash)>

Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.

Parameters:

  • inbox_id (String)

    Id of the inbox we are fetching emails from

  • count (Integer)

    Number of emails to wait for. Must be greater that 1

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:

  • (Array<(Array<EmailPreview>, Integer, Hash)>)

    Array<EmailPreview> data, response status code and response headers



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 115

def wait_for_email_count_with_http_info(inbox_id, count, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_email_count ...'
  end
  # verify the required parameter 'inbox_id' is set
  if @api_client.config.client_side_validation && inbox_id.nil?
    fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WaitForControllerApi.wait_for_email_count"
  end
  # verify the required parameter 'count' is set
  if @api_client.config.client_side_validation && count.nil?
    fail ArgumentError, "Missing the required parameter 'count' when calling WaitForControllerApi.wait_for_email_count"
  end
  if @api_client.config.client_side_validation && count < 1
    fail ArgumentError, 'invalid value for "count" when calling WaitForControllerApi.wait_for_email_count, must be greater than or equal to 1.'
  end

  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/waitForEmailCount'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = inbox_id
  query_params[:'count'] = count
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
  query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<EmailPreview>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_email_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_latest_email(opts = {}) ⇒ Email

Fetch inbox's latest email or if empty wait for an email to arrive Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set `unreadOnly=true` or see the other receive methods such as `waitForNthEmail` or `waitForEmailCount`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only. (default to false)

  • :before (DateTime)

    Filter for emails that were before after the given timestamp

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:



193
194
195
196
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 193

def wait_for_latest_email(opts = {})
  data, _status_code, _headers = wait_for_latest_email_with_http_info(opts)
  data
end

#wait_for_latest_email_with_http_info(opts = {}) ⇒ Array<(Email, Integer, Hash)>

Fetch inbox&#39;s latest email or if empty wait for an email to arrive Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set &#x60;unreadOnly&#x3D;true&#x60; or see the other receive methods such as &#x60;waitForNthEmail&#x60; or &#x60;waitForEmailCount&#x60;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only.

  • :before (DateTime)

    Filter for emails that were before after the given timestamp

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:

  • (Array<(Email, Integer, Hash)>)

    Email data, response status code and response headers



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 209

def wait_for_latest_email_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_latest_email ...'
  end
  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/waitForLatestEmail'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
  query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Email' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_latest_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_latest_sms(wait_for_single_sms_options, opts = {}) ⇒ SmsDto

Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. Wait until a phone number meets given conditions or return immediately if already met

Parameters:

Returns:



268
269
270
271
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 268

def wait_for_latest_sms(wait_for_single_sms_options, opts = {})
  data, _status_code, _headers = wait_for_latest_sms_with_http_info(wait_for_single_sms_options, opts)
  data
end

#wait_for_latest_sms_with_http_info(wait_for_single_sms_options, opts = {}) ⇒ Array<(SmsDto, Integer, Hash)>

Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. Wait until a phone number meets given conditions or return immediately if already met

Parameters:

Returns:

  • (Array<(SmsDto, Integer, Hash)>)

    SmsDto data, response status code and response headers



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 278

def wait_for_latest_sms_with_http_info(wait_for_single_sms_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_latest_sms ...'
  end
  # verify the required parameter 'wait_for_single_sms_options' is set
  if @api_client.config.client_side_validation && wait_for_single_sms_options.nil?
    fail ArgumentError, "Missing the required parameter 'wait_for_single_sms_options' when calling WaitForControllerApi.wait_for_latest_sms"
  end
  # resource path
  local_var_path = '/waitForLatestSms'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(wait_for_single_sms_options) 

  # return_type
  return_type = opts[:return_type] || 'SmsDto' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_latest_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_matching_emails(inbox_id, count, match_options, opts = {}) ⇒ Array<EmailPreview>

Wait or return list of emails that match simple matching patterns Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: ['SUBJECT',should:'CONTAIN',value:'needle'] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.

Parameters:

  • inbox_id (String)

    Id of the inbox we are fetching emails from

  • count (Integer)

    Number of emails to wait for. Must be greater or equal to 1

  • match_options (MatchOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only (default to false)

Returns:



340
341
342
343
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 340

def wait_for_matching_emails(inbox_id, count, match_options, opts = {})
  data, _status_code, _headers = wait_for_matching_emails_with_http_info(inbox_id, count, match_options, opts)
  data
end

#wait_for_matching_emails_with_http_info(inbox_id, count, match_options, opts = {}) ⇒ Array<(Array<EmailPreview>, Integer, Hash)>

Wait or return list of emails that match simple matching patterns Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the &#x60;MatchOptions&#x60; object for options. An example payload is &#x60;{ matches: [&#39;SUBJECT&#39;,should:&#39;CONTAIN&#39;,value:&#39;needle&#39;] }&#x60;. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController &#x60;getEmailContentMatch&#x60; method.

Parameters:

  • inbox_id (String)

    Id of the inbox we are fetching emails from

  • count (Integer)

    Number of emails to wait for. Must be greater or equal to 1

  • match_options (MatchOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only

Returns:

  • (Array<(Array<EmailPreview>, Integer, Hash)>)

    Array<EmailPreview> data, response status code and response headers



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 358

def wait_for_matching_emails_with_http_info(inbox_id, count, match_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_matching_emails ...'
  end
  # verify the required parameter 'inbox_id' is set
  if @api_client.config.client_side_validation && inbox_id.nil?
    fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WaitForControllerApi.wait_for_matching_emails"
  end
  # verify the required parameter 'count' is set
  if @api_client.config.client_side_validation && count.nil?
    fail ArgumentError, "Missing the required parameter 'count' when calling WaitForControllerApi.wait_for_matching_emails"
  end
  if @api_client.config.client_side_validation && count < 1
    fail ArgumentError, 'invalid value for "count" when calling WaitForControllerApi.wait_for_matching_emails, must be greater than or equal to 1.'
  end

  # verify the required parameter 'match_options' is set
  if @api_client.config.client_side_validation && match_options.nil?
    fail ArgumentError, "Missing the required parameter 'match_options' when calling WaitForControllerApi.wait_for_matching_emails"
  end
  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/waitForMatchingEmails'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = inbox_id
  query_params[:'count'] = count
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
  query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(match_options) 

  # return_type
  return_type = opts[:return_type] || 'Array<EmailPreview>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_matching_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_matching_first_email(inbox_id, match_options, opts = {}) ⇒ Email

Wait for or return the first email that matches provided MatchOptions array Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: ['SUBJECT',should:'CONTAIN',value:'needle'] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.

Parameters:

  • inbox_id (String)

    Id of the inbox we are matching an email for

  • match_options (MatchOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only (default to false)

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:



443
444
445
446
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 443

def wait_for_matching_first_email(inbox_id, match_options, opts = {})
  data, _status_code, _headers = wait_for_matching_first_email_with_http_info(inbox_id, match_options, opts)
  data
end

#wait_for_matching_first_email_with_http_info(inbox_id, match_options, opts = {}) ⇒ Array<(Email, Integer, Hash)>

Wait for or return the first email that matches provided MatchOptions array Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the &#x60;MatchOptions&#x60; object for options. An example payload is &#x60;{ matches: [&#39;SUBJECT&#39;,should:&#39;CONTAIN&#39;,value:&#39;needle&#39;] }&#x60;. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController &#x60;getEmailContentMatch&#x60; method.

Parameters:

  • inbox_id (String)

    Id of the inbox we are matching an email for

  • match_options (MatchOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :timeout (Integer)

    Max milliseconds to wait

  • :unread_only (Boolean)

    Optional filter for unread only

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:

  • (Array<(Email, Integer, Hash)>)

    Email data, response status code and response headers



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 460

def wait_for_matching_first_email_with_http_info(inbox_id, match_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_matching_first_email ...'
  end
  # verify the required parameter 'inbox_id' is set
  if @api_client.config.client_side_validation && inbox_id.nil?
    fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WaitForControllerApi.wait_for_matching_first_email"
  end
  # verify the required parameter 'match_options' is set
  if @api_client.config.client_side_validation && match_options.nil?
    fail ArgumentError, "Missing the required parameter 'match_options' when calling WaitForControllerApi.wait_for_matching_first_email"
  end
  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/waitForMatchingFirstEmail'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = inbox_id
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
  query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(match_options) 

  # return_type
  return_type = opts[:return_type] || 'Email' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_matching_first_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_nth_email(opts = {}) ⇒ Email

Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Id of the inbox you are fetching emails from

  • :index (Integer)

    Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index&#x3D;1 (default to 0)

  • :timeout (Integer)

    Max milliseconds to wait for the nth email if not already present

  • :unread_only (Boolean)

    Optional filter for unread only (default to false)

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:



536
537
538
539
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 536

def wait_for_nth_email(opts = {})
  data, _status_code, _headers = wait_for_nth_email_with_http_info(opts)
  data
end

#wait_for_nth_email_with_http_info(opts = {}) ⇒ Array<(Email, Integer, Hash)>

Wait for or fetch the email with a given index in the inbox specified. If index doesn&#39;t exist waits for it to exist or timeout to occur. If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Id of the inbox you are fetching emails from

  • :index (Integer)

    Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index&#x3D;1

  • :timeout (Integer)

    Max milliseconds to wait for the nth email if not already present

  • :unread_only (Boolean)

    Optional filter for unread only

  • :since (DateTime)

    Filter for emails that were received after the given timestamp

  • :before (DateTime)

    Filter for emails that were received before the given timestamp

  • :sort (String)

    Sort direction

  • :delay (Integer)

    Max milliseconds delay between calls

Returns:

  • (Array<(Email, Integer, Hash)>)

    Email data, response status code and response headers



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 553

def wait_for_nth_email_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_nth_email ...'
  end
  if @api_client.config.client_side_validation && !opts[:'index'].nil? && opts[:'index'] > 2147483647
    fail ArgumentError, 'invalid value for "opts[:"index"]" when calling WaitForControllerApi.wait_for_nth_email, must be smaller than or equal to 2147483647.'
  end

  if @api_client.config.client_side_validation && !opts[:'index'].nil? && opts[:'index'] < 0
    fail ArgumentError, 'invalid value for "opts[:"index"]" when calling WaitForControllerApi.wait_for_nth_email, must be greater than or equal to 0.'
  end

  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/waitForNthEmail'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
  query_params[:'index'] = opts[:'index'] if !opts[:'index'].nil?
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
  query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'delay'] = opts[:'delay'] if !opts[:'delay'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Email' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_nth_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_sms(wait_for_sms_conditions, opts = {}) ⇒ Array<SmsPreview>

Wait for an SMS message to match the provided filter conditions such as body contains keyword. Generic waitFor method that will wait until a phone number meets given conditions or return immediately if already met

Parameters:

  • wait_for_sms_conditions (WaitForSmsConditions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



621
622
623
624
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 621

def wait_for_sms(wait_for_sms_conditions, opts = {})
  data, _status_code, _headers = wait_for_sms_with_http_info(wait_for_sms_conditions, opts)
  data
end

#wait_for_sms_with_http_info(wait_for_sms_conditions, opts = {}) ⇒ Array<(Array<SmsPreview>, Integer, Hash)>

Wait for an SMS message to match the provided filter conditions such as body contains keyword. Generic waitFor method that will wait until a phone number meets given conditions or return immediately if already met

Parameters:

  • wait_for_sms_conditions (WaitForSmsConditions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<SmsPreview>, Integer, Hash)>)

    Array<SmsPreview> data, response status code and response headers



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 631

def wait_for_sms_with_http_info(wait_for_sms_conditions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_sms ...'
  end
  # verify the required parameter 'wait_for_sms_conditions' is set
  if @api_client.config.client_side_validation && wait_for_sms_conditions.nil?
    fail ArgumentError, "Missing the required parameter 'wait_for_sms_conditions' when calling WaitForControllerApi.wait_for_sms"
  end
  # resource path
  local_var_path = '/waitForSms'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(wait_for_sms_conditions) 

  # return_type
  return_type = opts[:return_type] || 'Array<SmsPreview>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_with_http_info(wait_for_conditions, opts = {}) ⇒ Array<(Array<EmailPreview>, Integer, Hash)>

Wait for an email to match the provided filter conditions such as subject contains keyword. Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met

Parameters:

  • wait_for_conditions (WaitForConditions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<EmailPreview>, Integer, Hash)>)

    Array<EmailPreview> data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mailslurp_client/api/wait_for_controller_api.rb', line 37

def wait_for_with_http_info(wait_for_conditions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for ...'
  end
  # verify the required parameter 'wait_for_conditions' is set
  if @api_client.config.client_side_validation && wait_for_conditions.nil?
    fail ArgumentError, "Missing the required parameter 'wait_for_conditions' when calling WaitForControllerApi.wait_for"
  end
  # resource path
  local_var_path = '/waitFor'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(wait_for_conditions) 

  # return_type
  return_type = opts[:return_type] || 'Array<EmailPreview>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end