Class: MailSlurpClient::FormControllerApi
- Inherits:
-
Object
- Object
- MailSlurpClient::FormControllerApi
- Defined in:
- lib/mailslurp_client/api/form_controller_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ FormControllerApi
constructor
A new instance of FormControllerApi.
-
#submit_form(opts = {}) ⇒ String
Submit a form to be parsed and sent as an email to an address determined by the form fields This endpoint allows you to submit HTML forms and receive the field values and files via email.
-
#submit_form_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Submit a form to be parsed and sent as an email to an address determined by the form fields This endpoint allows you to submit HTML forms and receive the field values and files via email.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ FormControllerApi
Returns a new instance of FormControllerApi.
19 20 21 |
# File 'lib/mailslurp_client/api/form_controller_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/mailslurp_client/api/form_controller_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#submit_form(opts = {}) ⇒ String
Submit a form to be parsed and sent as an email to an address determined by the form fields This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a ‘_to` email address to tell the endpoint where the form should be emailed. These can be submitted as hidden HTML input fields with the corresponding `name` attributes or as URL query parameters such as `[email protected]` The endpoint takes all other form fields that are named and includes them in the message body of the email. Files are sent as attachments. #### Submitting This endpoint accepts form submission via POST method. It accepts `application/x-www-form-urlencoded`, and `multipart/form-data` content-types. #### HTML Example “`html <form action="ruby.api.mailslurp.com/forms" method="post" > <input name="_to" type="hidden" value="[email protected]"/> <textarea name="feedback"></textarea> <button type="submit">Submit</button> </form> “` #### URL Example “`html <form action="ruby.api.mailslurp.com/[email protected]" method="post" > <textarea name="feedback"></textarea> <button type="submit">Submit</button> </form> “` The email address is specified by a `_to` field OR is extracted from an email alias specified by a `_toAlias` field (see the alias controller for more information). Endpoint accepts . You can specify a content type in HTML forms using the `enctype` attribute, for instance: `<form enctype="multipart/form-data">`.
33 34 35 36 |
# File 'lib/mailslurp_client/api/form_controller_api.rb', line 33 def submit_form(opts = {}) data, _status_code, _headers = submit_form_with_http_info(opts) data end |
#submit_form_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Submit a form to be parsed and sent as an email to an address determined by the form fields This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a `_to` email address to tell the endpoint where the form should be emailed. These can be submitted as hidden HTML input fields with the corresponding `name` attributes or as URL query parameters such as `?_to=[email protected]` The endpoint takes all other form fields that are named and includes them in the message body of the email. Files are sent as attachments. #### Submitting This endpoint accepts form submission via POST method. It accepts `application/x-www-form-urlencoded`, and `multipart/form-data` content-types. #### HTML Example ```html <form action="ruby.api.mailslurp.com/forms" method="post" > <input name="_to" type="hidden" value="[email protected]"/> <textarea name="feedback"></textarea> <button type="submit">Submit</button> </form> ``` #### URL Example ```html <form action="ruby.api.mailslurp.com/forms?_to=[email protected]" method="post" > <textarea name="feedback"></textarea> <button type="submit">Submit</button> </form> ``` The email address is specified by a `_to` field OR is extracted from an email alias specified by a `_toAlias` field (see the alias controller for more information). Endpoint accepts . You can specify a content type in HTML forms using the `enctype` attribute, for instance: `<form enctype="multipart/form-data">`.
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 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/mailslurp_client/api/form_controller_api.rb', line 49 def submit_form_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FormControllerApi.submit_form ...' end # resource path local_var_path = '/forms' # query parameters query_params = opts[:query_params] || {} query_params[:'_to'] = opts[:'_to'] if !opts[:'_to'].nil? query_params[:'_subject'] = opts[:'_subject'] if !opts[:'_subject'].nil? query_params[:'_redirectTo'] = opts[:'_redirect_to'] if !opts[:'_redirect_to'].nil? query_params[:'_emailAddress'] = opts[:'_email_address'] if !opts[:'_email_address'].nil? query_params[:'_successMessage'] = opts[:'_success_message'] if !opts[:'_success_message'].nil? query_params[:'_spamCheck'] = opts[:'_spam_check'] if !opts[:'_spam_check'].nil? query_params[:'otherParameters'] = opts[:'other_parameters'] if !opts[:'other_parameters'].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] || 'String' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] = 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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormControllerApi#submit_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |