Class: Sendmux::Sending::Generated::EmailsApi
- Inherits:
-
Object
- Object
- Sendmux::Sending::Generated::EmailsApi
- Defined in:
- lib/sendmux_sending_generated/api/emails_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) ⇒ EmailsApi
constructor
A new instance of EmailsApi.
-
#sending_send_email(email_send_request, opts = {}) ⇒ SendSuccessResponse
Send a single email Queue a single email for delivery.
-
#sending_send_email_batch(batch_send_request, opts = {}) ⇒ BatchSendSuccessResponse
Send a batch of emails Queue up to 100 emails for delivery in a single request.
-
#sending_send_email_batch_with_http_info(batch_send_request, opts = {}) ⇒ Array<(BatchSendSuccessResponse, Integer, Hash)>
Send a batch of emails Queue up to 100 emails for delivery in a single request.
-
#sending_send_email_with_http_info(email_send_request, opts = {}) ⇒ Array<(SendSuccessResponse, Integer, Hash)>
Send a single email Queue a single email for delivery.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/sendmux_sending_generated/api/emails_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#sending_send_email(email_send_request, opts = {}) ⇒ SendSuccessResponse
Send a single email Queue a single email for delivery. Requires ‘email.send` permission.
28 29 30 31 |
# File 'lib/sendmux_sending_generated/api/emails_api.rb', line 28 def sending_send_email(email_send_request, opts = {}) data, _status_code, _headers = sending_send_email_with_http_info(email_send_request, opts) data end |
#sending_send_email_batch(batch_send_request, opts = {}) ⇒ BatchSendSuccessResponse
Send a batch of emails Queue up to 100 emails for delivery in a single request. Uses partial success model — individual message failures do not fail the entire batch. Requires ‘email.send` permission.
112 113 114 115 |
# File 'lib/sendmux_sending_generated/api/emails_api.rb', line 112 def sending_send_email_batch(batch_send_request, opts = {}) data, _status_code, _headers = sending_send_email_batch_with_http_info(batch_send_request, opts) data end |
#sending_send_email_batch_with_http_info(batch_send_request, opts = {}) ⇒ Array<(BatchSendSuccessResponse, Integer, Hash)>
Send a batch of emails Queue up to 100 emails for delivery in a single request. Uses partial success model — individual message failures do not fail the entire batch. Requires `email.send` permission.
123 124 125 126 127 128 129 130 131 132 133 134 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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/sendmux_sending_generated/api/emails_api.rb', line 123 def sending_send_email_batch_with_http_info(batch_send_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailsApi.sending_send_email_batch ...' end # verify the required parameter 'batch_send_request' is set if @api_client.config.client_side_validation && batch_send_request.nil? fail ArgumentError, "Missing the required parameter 'batch_send_request' when calling EmailsApi.sending_send_email_batch" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email_batch, the character length must be smaller than or equal to 255.' end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email_batch, the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/) if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.sending_send_email_batch, must conform to the pattern #{pattern}." end # resource path local_var_path = '/emails/send/batch' # 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']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_send_request) # return_type return_type = opts[:debug_return_type] || 'BatchSendSuccessResponse' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] = opts.merge( :operation => :"EmailsApi.sending_send_email_batch", :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: EmailsApi#sending_send_email_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#sending_send_email_with_http_info(email_send_request, opts = {}) ⇒ Array<(SendSuccessResponse, Integer, Hash)>
Send a single email Queue a single email for delivery. Requires `email.send` permission.
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 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 |
# File 'lib/sendmux_sending_generated/api/emails_api.rb', line 39 def sending_send_email_with_http_info(email_send_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailsApi.sending_send_email ...' end # verify the required parameter 'email_send_request' is set if @api_client.config.client_side_validation && email_send_request.nil? fail ArgumentError, "Missing the required parameter 'email_send_request' when calling EmailsApi.sending_send_email" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email, the character length must be smaller than or equal to 255.' end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email, the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/) if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.sending_send_email, must conform to the pattern #{pattern}." end # resource path local_var_path = '/emails/send' # 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']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(email_send_request) # return_type return_type = opts[:debug_return_type] || 'SendSuccessResponse' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] = opts.merge( :operation => :"EmailsApi.sending_send_email", :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: EmailsApi#sending_send_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |