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 = {}) ⇒ Inbox

Create new random inbox 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_actions_controller_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, 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

Returns:

  • (Array<(Inbox, Integer, 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
68
69
70
71
72
73
74
75
76
# File 'lib/mailslurp_client/api/common_actions_controller_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: CommonActionsControllerApi.create_new_email_address ...'
  end
  # resource path
  local_var_path = '/newEmailAddress'

  # 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(['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 = {}) ⇒ nil

Delete all emails in an inbox Deletes all emails

Parameters:

  • inbox_id (String)

    inboxId

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

    the optional parameters

Returns:

  • (nil)


83
84
85
86
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 83

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)

    inboxId

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 93

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(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)

    sendEmailOptions

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

    the optional parameters

Returns:

  • (nil)


144
145
146
147
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 144

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

    sendEmailOptions

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/mailslurp_client/api/common_actions_controller_api.rb', line 154

def send_email_simple_with_http_info(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 '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 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(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