class MailSlurpClient::CommonActionsControllerApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_new_email_address(opts = {}) click to toggle source

Create new random inbox Returns an Inbox with an `id` and an `emailAddress` @param [Hash] opts the optional parameters @option opts [Boolean] :allow_team_access allowTeamAccess @option opts [String] :description description @option opts [String] :email_address emailAddress @option opts [DateTime] :expires_at expiresAt @option opts [Integer] :expires_in expiresIn @option opts [Boolean] :favourite favourite @option opts [String] :inbox_type inboxType @option opts [String] :name name @option opts [Array<String>] :tags tags @option opts [Boolean] :use_domain_pool useDomainPool @return [Inbox]

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 36
def create_new_email_address(opts = {})
  data, _status_code, _headers = create_new_email_address_with_http_info(opts)
  data
end
create_new_email_address1(opts = {}) click to toggle source

Create new random inbox Returns an Inbox with an `id` and an `emailAddress` @param [Hash] opts the optional parameters @option opts [Boolean] :allow_team_access allowTeamAccess @option opts [String] :description description @option opts [String] :email_address emailAddress @option opts [DateTime] :expires_at expiresAt @option opts [Integer] :expires_in expiresIn @option opts [Boolean] :favourite favourite @option opts [String] :inbox_type inboxType @option opts [String] :name name @option opts [Array<String>] :tags tags @option opts [Boolean] :use_domain_pool useDomainPool @return [Inbox]

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 126
def create_new_email_address1(opts = {})
  data, _status_code, _headers = create_new_email_address1_with_http_info(opts)
  data
end
create_new_email_address1_with_http_info(opts = {}) click to toggle source

Create new random inbox Returns an Inbox with an &#x60;id&#x60; and an &#x60;emailAddress&#x60; @param [Hash] opts the optional parameters @option opts [Boolean] :allow_team_access allowTeamAccess @option opts [String] :description description @option opts [String] :email_address emailAddress @option opts [DateTime] :expires_at expiresAt @option opts [Integer] :expires_in expiresIn @option opts [Boolean] :favourite favourite @option opts [String] :inbox_type inboxType @option opts [String] :name name @option opts [Array<String>] :tags tags @option opts [Boolean] :use_domain_pool useDomainPool @return [Array<(Inbox, Integer, Hash)>] Inbox data, response status code and response headers

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 145
def create_new_email_address1_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonActionsControllerApi.create_new_email_address1 ...'
  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[:'description'] = opts[:'description'] if !opts[:'description'].nil?
  query_params[:'emailAddress'] = opts[:'email_address'] if !opts[:'email_address'].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[:'favourite'] = opts[:'favourite'] if !opts[:'favourite'].nil?
  query_params[:'inboxType'] = opts[:'inbox_type'] if !opts[:'inbox_type'].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[:'useDomainPool'] = opts[:'use_domain_pool'] if !opts[:'use_domain_pool'].nil?

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

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

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

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

  # 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_address1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_new_email_address_with_http_info(opts = {}) click to toggle source

Create new random inbox Returns an Inbox with an &#x60;id&#x60; and an &#x60;emailAddress&#x60; @param [Hash] opts the optional parameters @option opts [Boolean] :allow_team_access allowTeamAccess @option opts [String] :description description @option opts [String] :email_address emailAddress @option opts [DateTime] :expires_at expiresAt @option opts [Integer] :expires_in expiresIn @option opts [Boolean] :favourite favourite @option opts [String] :inbox_type inboxType @option opts [String] :name name @option opts [Array<String>] :tags tags @option opts [Boolean] :use_domain_pool useDomainPool @return [Array<(Inbox, Integer, Hash)>] Inbox data, response status code and response headers

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'allowTeamAccess'] = opts[:'allow_team_access'] if !opts[:'allow_team_access'].nil?
  query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?
  query_params[:'emailAddress'] = opts[:'email_address'] if !opts[:'email_address'].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[:'favourite'] = opts[:'favourite'] if !opts[:'favourite'].nil?
  query_params[:'inboxType'] = opts[:'inbox_type'] if !opts[:'inbox_type'].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[:'useDomainPool'] = opts[:'use_domain_pool'] if !opts[:'use_domain_pool'].nil?

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

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

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

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

  # 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
empty_inbox(inbox_id, opts = {}) click to toggle source

Delete all emails in an inbox Deletes all emails @param inbox_id [String] inboxId @param [Hash] opts the optional parameters @return [nil]

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 207
def empty_inbox(inbox_id, opts = {})
  empty_inbox_with_http_info(inbox_id, opts)
  nil
end
empty_inbox_with_http_info(inbox_id, opts = {}) click to toggle source

Delete all emails in an inbox Deletes all emails @param inbox_id [String] inboxId @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 217
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_simple(email_options, opts = {}) click to toggle source

Send an email If no senderId or inboxId provided a random email address will be used to send from. @param email_options [SimpleSendEmailOptions] emailOptions @param [Hash] opts the optional parameters @return [nil]

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 268
def send_email_simple(email_options, opts = {})
  send_email_simple_with_http_info(email_options, opts)
  nil
end
send_email_simple_with_http_info(email_options, opts = {}) click to toggle source

Send an email If no senderId or inboxId provided a random email address will be used to send from. @param email_options [SimpleSendEmailOptions] emailOptions @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/mailslurp_client/api/common_actions_controller_api.rb, line 278
def send_email_simple_with_http_info(email_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CommonActionsControllerApi.send_email_simple ...'
  end
  # verify the required parameter 'email_options' is set
  if @api_client.config.client_side_validation && email_options.nil?
    fail ArgumentError, "Missing the required parameter '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(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