Class: MailSlurpClient::CommonOperationsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CommonOperationsApi

Returns a new instance of CommonOperationsApi.



19
20
21
# File 'lib/mailslurp_client/api/common_operations_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/common_operations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_new_email_address(opts = {}) ⇒ Inbox

Create new email address Returns an Inbox with an ‘id` and an `emailAddress`

Parameters:

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

    the optional parameters

Returns:



26
27
28
29
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 26

def create_new_email_address(opts = {})
  data, _status_code, _headers = create_new_email_address_with_http_info(opts)
  data
end

#create_new_email_address_with_http_info(opts = {}) ⇒ Array<(Inbox, Fixnum, Hash)>

Create new email address Returns an Inbox with an &#x60;id&#x60; and an &#x60;emailAddress&#x60;

Parameters:

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

    the optional parameters

Returns:

  • (Array<(Inbox, Fixnum, Hash)>)

    Inbox data, response status code and response headers



35
36
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
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 35

def create_new_email_address_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.create_new_email_address ...'
  end
  # resource path
  local_var_path = '/newEmailAddress'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Inbox')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#create_new_email_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_email(email_id, opts = {}) ⇒ nil

Delete an email Deletes an email

Parameters:

  • email_id

    emailId

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

    the optional parameters

Returns:

  • (nil)


74
75
76
77
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 74

def delete_email(email_id, opts = {})
  delete_email_with_http_info(email_id, opts)
  nil
end

#delete_email_address(inbox_id, opts = {}) ⇒ nil

Delete email address and its emails Deletes an inbox

Parameters:

  • inbox_id

    inboxId

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

    the optional parameters

Returns:

  • (nil)


125
126
127
128
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 125

def delete_email_address(inbox_id, opts = {})
  delete_email_address_with_http_info(inbox_id, opts)
  nil
end

#delete_email_address_with_http_info(inbox_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete email address and its emails Deletes an inbox

Parameters:

  • inbox_id

    inboxId

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



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
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 135

def delete_email_address_with_http_info(inbox_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.delete_email_address ...'
  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 CommonOperationsApi.delete_email_address"
  end
  # resource path
  local_var_path = '/deleteEmailAddress'

  # query parameters
  query_params = {}
  query_params[:'inboxId'] = inbox_id

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#delete_email_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_email_with_http_info(email_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete an email Deletes an email

Parameters:

  • email_id

    emailId

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 84

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

  # query parameters
  query_params = {}
  query_params[:'emailId'] = email_id

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#delete_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#empty_inbox(inbox_id, opts = {}) ⇒ nil

Delete all emails in an inbox Deletes all emails

Parameters:

  • inbox_id

    inboxId

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

    the optional parameters

Returns:

  • (nil)


176
177
178
179
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 176

def empty_inbox(inbox_id, opts = {})
  empty_inbox_with_http_info(inbox_id, opts)
  nil
end

#empty_inbox_with_http_info(inbox_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete all emails in an inbox Deletes all emails

Parameters:

  • inbox_id

    inboxId

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 186

def empty_inbox_with_http_info(inbox_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.empty_inbox ...'
  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 CommonOperationsApi.empty_inbox"
  end
  # resource path
  local_var_path = '/emptyInbox'

  # query parameters
  query_params = {}
  query_params[:'inboxId'] = inbox_id

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#empty_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_email_simple(send_email_options, opts = {}) ⇒ nil

Send an email from a random email address To specify an email address first create an inbox and use that with the other send email methods

Parameters:

  • send_email_options

    sendEmailOptions

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

    the optional parameters

Returns:

  • (nil)


227
228
229
230
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 227

def send_email_simple(send_email_options, opts = {})
  send_email_simple_with_http_info(send_email_options, opts)
  nil
end

#send_email_simple_with_http_info(send_email_options, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send an email from a random email address To specify an email address first create an inbox and use that with the other send email methods

Parameters:

  • send_email_options

    sendEmailOptions

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



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
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 237

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

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(send_email_options)
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#send_email_simple\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Wait for and return count number of emails Will only wait if count is greater that the found emails in given inbox.If you need to wait for an email for a non-empty inbox see the other receive methods.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :count (Integer)

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

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :timeout (Integer)

    Max milliseconds to wait

Returns:



281
282
283
284
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 281

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

#wait_for_email_count_with_http_info(opts = {}) ⇒ Array<(Array<EmailPreview>, Fixnum, Hash)>

Wait for and return count number of emails Will only wait if count is greater that the found emails in given inbox.If you need to wait for an email for a non-empty inbox see the other receive methods.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :count (Integer)

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

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :timeout (Integer)

    Max milliseconds to wait

Returns:

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

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



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
326
327
328
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 293

def wait_for_email_count_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.wait_for_email_count ...'
  end
  # resource path
  local_var_path = '/waitForEmailCount'

  # query parameters
  query_params = {}
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<EmailPreview>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#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 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 see the other receive methods.

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

Returns:



336
337
338
339
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 336

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, Fixnum, Hash)>

Fetch inbox&#39;s latest email or if empty wait for 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 see the other receive methods.

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

Returns:

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

    Email data, response status code and response headers



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 347

def wait_for_latest_email_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.wait_for_latest_email ...'
  end
  # resource path
  local_var_path = '/waitForLatestEmail'

  # query parameters
  query_params = {}
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Email')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#wait_for_latest_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#wait_for_matching_email(match_options, opts = {}) ⇒ Array<EmailPreview>

Wait or return list of emails that match simple matching patterns Results must also meet provided count. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM.

Parameters:

  • match_options

    matchOptions

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

    the optional parameters

Options Hash (opts):

  • :count (Integer)

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

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :timeout (Integer)

    Max milliseconds to wait

Returns:



391
392
393
394
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 391

def wait_for_matching_email(match_options, opts = {})
  data, _status_code, _headers = wait_for_matching_email_with_http_info(match_options, opts)
  data
end

#wait_for_matching_email_with_http_info(match_options, opts = {}) ⇒ Array<(Array<EmailPreview>, Fixnum, Hash)>

Wait or return list of emails that match simple matching patterns Results must also meet provided count. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM.

Parameters:

  • match_options

    matchOptions

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

    the optional parameters

Options Hash (opts):

  • :count (Integer)

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

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :timeout (Integer)

    Max milliseconds to wait

Returns:

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

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



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
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 404

def wait_for_matching_email_with_http_info(match_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.wait_for_matching_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 CommonOperationsApi.wait_for_matching_email"
  end
  # resource path
  local_var_path = '/waitForMatchingEmails'

  # query parameters
  query_params = {}
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(match_options)
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<EmailPreview>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#wait_for_matching_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

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :index (Integer)

    Zero based index of the email to wait for

  • :timeout (Integer)

    Max milliseconds to wait

Returns:



453
454
455
456
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 453

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, Fixnum, Hash)>

Wait for or fetch the email with a given index in the inbox specified

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Id of the inbox we are fetching emails from

  • :index (Integer)

    Zero based index of the email to wait for

  • :timeout (Integer)

    Max milliseconds to wait

Returns:

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

    Email data, response status code and response headers



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
# File 'lib/mailslurp_client/api/common_operations_api.rb', line 464

def wait_for_nth_email_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonOperationsApi.wait_for_nth_email ...'
  end
  # resource path
  local_var_path = '/waitForNthEmail'

  # query parameters
  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?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_KEY']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Email')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonOperationsApi#wait_for_nth_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end