Class: MailSlurpClient::CommonActionsControllerApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CommonActionsControllerApi

Returns a new instance of CommonActionsControllerApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_new_email_address(opts = {}) ⇒ InboxDto

Create new random inbox Returns an Inbox with an ‘id` and an `emailAddress`

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :allow_team_access (Boolean)
  • :use_domain_pool (Boolean)
  • :expires_at (DateTime)
  • :expires_in (Integer)
  • :email_address (String)
  • :inbox_type (String)
  • :description (String)
  • :name (String)
  • :tags (Array<String>)
  • :favourite (Boolean)
  • :virtual_inbox (Boolean)
  • :use_short_address (Boolean)
  • :domain_name (String)
  • :domain_id (String)
  • :prefix (String)

Returns:



41
42
43
44
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 41

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<(InboxDto, Integer, Hash)>

Create new random inbox Returns an Inbox with an &#x60;id&#x60; and an &#x60;emailAddress&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :allow_team_access (Boolean)
  • :use_domain_pool (Boolean)
  • :expires_at (DateTime)
  • :expires_in (Integer)
  • :email_address (String)
  • :inbox_type (String)
  • :description (String)
  • :name (String)
  • :tags (Array<String>)
  • :favourite (Boolean)
  • :virtual_inbox (Boolean)
  • :use_short_address (Boolean)
  • :domain_name (String)
  • :domain_id (String)
  • :prefix (String)

Returns:

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

    InboxDto data, response status code and response headers



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
119
120
121
122
123
124
125
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 65

def create_new_email_address_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonActionsControllerApi.create_new_email_address ...'
  end
  allowable_values = ["HTTP_INBOX", "SMTP_INBOX"]
  if @api_client.config.client_side_validation && opts[:'inbox_type'] && !allowable_values.include?(opts[:'inbox_type'])
    fail ArgumentError, "invalid value for \"inbox_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/newEmailAddress'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'allowTeamAccess'] = opts[:'allow_team_access'] if !opts[:'allow_team_access'].nil?
  query_params[:'useDomainPool'] = opts[:'use_domain_pool'] if !opts[:'use_domain_pool'].nil?
  query_params[:'expiresAt'] = opts[:'expires_at'] if !opts[:'expires_at'].nil?
  query_params[:'expiresIn'] = opts[:'expires_in'] if !opts[:'expires_in'].nil?
  query_params[:'emailAddress'] = opts[:'email_address'] if !opts[:'email_address'].nil?
  query_params[:'inboxType'] = opts[:'inbox_type'] if !opts[:'inbox_type'].nil?
  query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?
  query_params[:'favourite'] = opts[:'favourite'] if !opts[:'favourite'].nil?
  query_params[:'virtualInbox'] = opts[:'virtual_inbox'] if !opts[:'virtual_inbox'].nil?
  query_params[:'useShortAddress'] = opts[:'use_short_address'] if !opts[:'use_short_address'].nil?
  query_params[:'domainName'] = opts[:'domain_name'] if !opts[:'domain_name'].nil?
  query_params[:'domainId'] = opts[:'domain_id'] if !opts[:'domain_id'].nil?
  query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].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] || 'InboxDto' 

  # 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: CommonActionsControllerApi#create_new_email_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_random_inbox(opts = {}) ⇒ InboxDto

Create new random inbox Returns an Inbox with an ‘id` and an `emailAddress`

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :allow_team_access (Boolean)
  • :use_domain_pool (Boolean)
  • :expires_at (DateTime)
  • :expires_in (Integer)
  • :email_address (String)
  • :inbox_type (String)
  • :description (String)
  • :name (String)
  • :tags (Array<String>)
  • :favourite (Boolean)
  • :virtual_inbox (Boolean)
  • :use_short_address (Boolean)
  • :domain_name (String)
  • :domain_id (String)
  • :prefix (String)

Returns:



146
147
148
149
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 146

def create_random_inbox(opts = {})
  data, _status_code, _headers = create_random_inbox_with_http_info(opts)
  data
end

#create_random_inbox_with_http_info(opts = {}) ⇒ Array<(InboxDto, Integer, Hash)>

Create new random inbox Returns an Inbox with an &#x60;id&#x60; and an &#x60;emailAddress&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :allow_team_access (Boolean)
  • :use_domain_pool (Boolean)
  • :expires_at (DateTime)
  • :expires_in (Integer)
  • :email_address (String)
  • :inbox_type (String)
  • :description (String)
  • :name (String)
  • :tags (Array<String>)
  • :favourite (Boolean)
  • :virtual_inbox (Boolean)
  • :use_short_address (Boolean)
  • :domain_name (String)
  • :domain_id (String)
  • :prefix (String)

Returns:

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

    InboxDto data, response status code and response headers



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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
221
222
223
224
225
226
227
228
229
230
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 170

def create_random_inbox_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonActionsControllerApi.create_random_inbox ...'
  end
  allowable_values = ["HTTP_INBOX", "SMTP_INBOX"]
  if @api_client.config.client_side_validation && opts[:'inbox_type'] && !allowable_values.include?(opts[:'inbox_type'])
    fail ArgumentError, "invalid value for \"inbox_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/createInbox'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'allowTeamAccess'] = opts[:'allow_team_access'] if !opts[:'allow_team_access'].nil?
  query_params[:'useDomainPool'] = opts[:'use_domain_pool'] if !opts[:'use_domain_pool'].nil?
  query_params[:'expiresAt'] = opts[:'expires_at'] if !opts[:'expires_at'].nil?
  query_params[:'expiresIn'] = opts[:'expires_in'] if !opts[:'expires_in'].nil?
  query_params[:'emailAddress'] = opts[:'email_address'] if !opts[:'email_address'].nil?
  query_params[:'inboxType'] = opts[:'inbox_type'] if !opts[:'inbox_type'].nil?
  query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?
  query_params[:'favourite'] = opts[:'favourite'] if !opts[:'favourite'].nil?
  query_params[:'virtualInbox'] = opts[:'virtual_inbox'] if !opts[:'virtual_inbox'].nil?
  query_params[:'useShortAddress'] = opts[:'use_short_address'] if !opts[:'use_short_address'].nil?
  query_params[:'domainName'] = opts[:'domain_name'] if !opts[:'domain_name'].nil?
  query_params[:'domainId'] = opts[:'domain_id'] if !opts[:'domain_id'].nil?
  query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].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] || 'InboxDto' 

  # 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: CommonActionsControllerApi#create_random_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Delete inbox email address by inbox id Deletes inbox email address

Parameters:

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

    the optional parameters

Returns:

  • (nil)


237
238
239
240
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 237

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

Delete inbox email address by inbox id Deletes inbox email address

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 247

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

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:return_type] 

  # 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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonActionsControllerApi#delete_email_address\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 (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


298
299
300
301
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 298

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

Delete all emails in an inbox Deletes all emails

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 308

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

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:return_type] 

  # 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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CommonActionsControllerApi#empty_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_email_query(to, opts = {}) ⇒ nil

Send an email using query parameters If no senderId or inboxId provided a random email address will be used to send from. Ensure your parameters are URL encoded.

Parameters:

  • to (String)

    Email address to send to

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

    the optional parameters

Options Hash (opts):

  • :sender_id (String)

    ID of inbox to send from. If null an inbox will be created for sending

  • :body (String)

    Body of the email message. Supports HTML

  • :subject (String)

    Subject line of the email

Returns:

  • (nil)


362
363
364
365
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 362

def send_email_query(to, opts = {})
  send_email_query_with_http_info(to, opts)
  nil
end

#send_email_query_with_http_info(to, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Send an email using query parameters If no senderId or inboxId provided a random email address will be used to send from. Ensure your parameters are URL encoded.

Parameters:

  • to (String)

    Email address to send to

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

    the optional parameters

Options Hash (opts):

  • :sender_id (String)

    ID of inbox to send from. If null an inbox will be created for sending

  • :body (String)

    Body of the email message. Supports HTML

  • :subject (String)

    Subject line of the email

Returns:

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

    nil, response status code and response headers



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

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'to'] = to
  query_params[:'senderId'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?
  query_params[:'body'] = opts[:'body'] if !opts[:'body'].nil?
  query_params[:'subject'] = opts[:'subject'] if !opts[:'subject'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:return_type] 

  # 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: CommonActionsControllerApi#send_email_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Send an email If no senderId or inboxId provided a random email address will be used to send from.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


429
430
431
432
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 429

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

#send_email_simple_with_http_info(simple_send_email_options, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Send an email If no senderId or inboxId provided a random email address will be used to send from.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
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
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 439

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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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(simple_send_email_options) 

  # return_type
  return_type = opts[:return_type] 

  # 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: CommonActionsControllerApi#send_email_simple\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end