ElasticEmail 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +2 -2
- data/ElasticEmail-4.3.0.gem +0 -0
- data/README.md +43 -3
- data/VERSION +1 -1
- data/docs/EmailsApi.md +24 -12
- data/lib/ElasticEmail/api/emails_api.rb +48 -0
- data/lib/ElasticEmail/version.rb +1 -1
- data/spec/api/emails_api_spec.rb +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9470d9689fcf9c6e65c1f44be797ab27561bd5bcd98fb0b6baf35d6e210e4e16
|
|
4
|
+
data.tar.gz: d95732e383fcca6800e5609743054143063a90e7f408b68496d13b53e5d100a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 214c80b3c7b460233b9ccdf72756f35628c35f5b68990e5097fb7fb5b7ead366dd15269be80ff73c617f4cf752585514e117ebcafde40f6748d81ff89b2a660c
|
|
7
|
+
data.tar.gz: 9775b6796a85898870e941131e0c6f7b5f076588e9936725e5e7d3b73f051005497fe52aee536f75fdd01122cff105942b70ae1ea295f5d2f730bbac7218b6f6
|
data/CONTRIBUTING.md
CHANGED
|
@@ -18,7 +18,7 @@ If you're not sure whether something is generated, open an issue first and ask.
|
|
|
18
18
|
|
|
19
19
|
Search [existing issues](https://github.com/ElasticEmail/elasticemail-ruby/issues) first. If nothing matches, open a new issue using the **Bug report** template and include:
|
|
20
20
|
|
|
21
|
-
- SDK version (from RubyGems, e.g. `4.
|
|
21
|
+
- SDK version (from RubyGems, e.g. `4.4.0`; run `gem list ElasticEmail`)
|
|
22
22
|
- Ruby version (`ruby -v`)
|
|
23
23
|
- The API method you called and a minimal code sample
|
|
24
24
|
- The full error message, HTTP status code and response body (`ElasticEmail::ApiError#code` and `#response_body`)
|
|
@@ -52,7 +52,7 @@ To build and install the gem locally:
|
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
gem build ElasticEmail.gemspec
|
|
55
|
-
gem install ./ElasticEmail-4.
|
|
55
|
+
gem install ./ElasticEmail-4.4.0.gem
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Keep the gem compatible with Ruby 2.7 and don't add new runtime dependencies without discussing it in an issue first.
|
|
Binary file
|
data/README.md
CHANGED
|
@@ -32,11 +32,12 @@ The official Ruby client library for the [Elastic Email](https://elasticemail.co
|
|
|
32
32
|
## Features
|
|
33
33
|
|
|
34
34
|
- **Transactional and bulk email.** Send single messages, bulk campaigns or CSV merge-file sends.
|
|
35
|
+
- **Safe retries.** Pass an optional `Idempotency-Key` to a send, so a retried request returns the first result instead of sending the email twice.
|
|
35
36
|
- **Contacts, lists and segments.** Add, update, import, export and bulk-delete contacts.
|
|
36
37
|
- **Campaigns and automations.** Create, update, pause and trigger automations for a contact.
|
|
37
38
|
- **Templates, files and attachments.** Manage templates and uploaded files.
|
|
38
39
|
- **Domains.** Verify sending domains and check SPF, DKIM, tracking and certificate status.
|
|
39
|
-
- **Webhooks and inbound routes.** Receive delivery events and route incoming mail.
|
|
40
|
+
- **Webhooks and inbound routes.** Receive delivery events, optionally signed with HMAC-SHA256 and sent as JSON, and route incoming mail.
|
|
40
41
|
- **Statistics, events and suppressions.** Track delivery, bounces, complaints and unsubscribes.
|
|
41
42
|
- **Subaccounts and security.** Manage subaccounts and API keys.
|
|
42
43
|
- **Plain Ruby objects.** Models are built from keyword hashes with snake_case keys, and every call has a `…_with_http_info` variant that also returns the status code and headers.
|
|
@@ -61,7 +62,7 @@ gem install ElasticEmail
|
|
|
61
62
|
Or add it to your `Gemfile`:
|
|
62
63
|
|
|
63
64
|
```ruby
|
|
64
|
-
gem 'ElasticEmail', '~> 4.
|
|
65
|
+
gem 'ElasticEmail', '~> 4.4'
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
and run `bundle install`. RubyGems installs the dependency ([Typhoeus](https://rubygems.org/gems/typhoeus)) for you.
|
|
@@ -111,6 +112,21 @@ end
|
|
|
111
112
|
|
|
112
113
|
The `from` address must use a domain you've [verified in your Elastic Email account](https://help.elasticemail.com/en/articles/4934400-how-to-verify-your-domain).
|
|
113
114
|
|
|
115
|
+
### Retry a send safely (Idempotency-Key)
|
|
116
|
+
|
|
117
|
+
```ruby
|
|
118
|
+
require 'securerandom'
|
|
119
|
+
|
|
120
|
+
# One key per logical send. Reuse it only when you retry this same send.
|
|
121
|
+
idempotency_key = SecureRandom.uuid
|
|
122
|
+
|
|
123
|
+
# After a timeout or connection error, call this again with the same message and the same key.
|
|
124
|
+
result = emails.emails_transactional_post(message, idempotency_key: idempotency_key)
|
|
125
|
+
puts "TransactionID: #{result.transaction_id}"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
If the same key arrives again with the same request within 24 hours, Elastic Email returns the stored response of the first one (same `TransactionID` and `MessageID`, plus an `Idempotency-Replayed: true` response header) and doesn't send or charge again. Retry with an identical body: the same key with a different body gets `422`, and a retry while the first request is still running gets `409`. A `503` means the key couldn't be checked, so wait for the `Retry-After` seconds and retry with the same key. `emails_post` and `emails_mergefile_post` take the same `idempotency_key:` option, and sends without a key work as before.
|
|
129
|
+
|
|
114
130
|
### Send from a template with merge fields
|
|
115
131
|
|
|
116
132
|
```ruby
|
|
@@ -136,6 +152,30 @@ ElasticEmail.configure do |config|
|
|
|
136
152
|
end
|
|
137
153
|
```
|
|
138
154
|
|
|
155
|
+
### Create a signed webhook
|
|
156
|
+
|
|
157
|
+
Webhooks can sign every request with HMAC-SHA256 and send events as a `POST` with a JSON body. Both options are set when you create the webhook and can't be changed later. Webhooks created without them keep working as unsigned `GET` requests.
|
|
158
|
+
|
|
159
|
+
```ruby
|
|
160
|
+
webhooks = ElasticEmail::WebhookApi.new
|
|
161
|
+
|
|
162
|
+
payload = ElasticEmail::WebhookCreatePayload.new(
|
|
163
|
+
name: 'my-webhook',
|
|
164
|
+
url: 'https://your-app.example.com/webhook',
|
|
165
|
+
notification_for_sent: true,
|
|
166
|
+
notification_for_opened: true,
|
|
167
|
+
notification_for_clicked: true,
|
|
168
|
+
enable_signing: true,
|
|
169
|
+
delivery_method: ElasticEmail::WebhookDeliveryMethod::POST_JSON
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
webhook = webhooks.webhook_post(payload)
|
|
173
|
+
# Returned only now: store it, e.g. as ELASTICEMAIL_WEBHOOK_SECRET.
|
|
174
|
+
puts webhook.signing_secret
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`SigningSecret` is returned only when the webhook is created and when you rotate it with `webhook_by_publicid_secret_rotate_post`, so store it right away. Each signed request carries `X-ElasticEmail-Timestamp` and `X-ElasticEmail-Signature: v1=<hex>`, where the signature is `hex(HMAC-SHA256(secret, "{timestamp}\n{METHOD}\n{path and query}\n{raw body}"))`. Verify it against the raw body before you parse the JSON, reject timestamps more than 5 minutes old, and compare in constant time. The [webhooks guide](https://github.com/ElasticEmail/elasticemail-examples/blob/main/docs/webhooks.md) and the [examples repository](https://github.com/ElasticEmail/elasticemail-examples) have ready-made handlers.
|
|
178
|
+
|
|
139
179
|
## More examples
|
|
140
180
|
|
|
141
181
|
More complete, runnable samples are in the **[Elastic Email examples repository](https://github.com/ElasticEmail/elasticemail-examples)**. It covers transactional email, SMTP, webhooks, inbound email, contacts and serverless platforms across 20+ languages and frameworks.
|
|
@@ -406,7 +446,7 @@ The SDK follows the Elastic Email API v4. Package versions and release notes are
|
|
|
406
446
|
<summary>Build details</summary>
|
|
407
447
|
|
|
408
448
|
- API version: 4.0.0
|
|
409
|
-
- SDK version: 4.
|
|
449
|
+
- SDK version: 4.4.0
|
|
410
450
|
- Generator version: 7.11.0
|
|
411
451
|
- Build package: `org.openapitools.codegen.languages.RubyClientCodegen`
|
|
412
452
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.4.0
|
data/docs/EmailsApi.md
CHANGED
|
@@ -177,7 +177,7 @@ end
|
|
|
177
177
|
|
|
178
178
|
## emails_mergefile_post
|
|
179
179
|
|
|
180
|
-
> <EmailSend> emails_mergefile_post(merge_email_payload)
|
|
180
|
+
> <EmailSend> emails_mergefile_post(merge_email_payload, opts)
|
|
181
181
|
|
|
182
182
|
Send Bulk Emails CSV
|
|
183
183
|
|
|
@@ -198,10 +198,13 @@ end
|
|
|
198
198
|
|
|
199
199
|
api_instance = ElasticEmail::EmailsApi.new
|
|
200
200
|
merge_email_payload = ElasticEmail::MergeEmailPayload.new({merge_file: ElasticEmail::MessageAttachment.new({binary_content: 'binary_content_example', name: 'name_example'}), content: ElasticEmail::EmailContent.new({from: 'John Doe <email@domain.com>'})}) # MergeEmailPayload | Email data
|
|
201
|
+
opts = {
|
|
202
|
+
idempotency_key: '6f1c2a7e-3b4d-4e8f-9a1b-2c3d4e5f6a7b' # String | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
203
|
+
}
|
|
201
204
|
|
|
202
205
|
begin
|
|
203
206
|
# Send Bulk Emails CSV
|
|
204
|
-
result = api_instance.emails_mergefile_post(merge_email_payload)
|
|
207
|
+
result = api_instance.emails_mergefile_post(merge_email_payload, opts)
|
|
205
208
|
p result
|
|
206
209
|
rescue ElasticEmail::ApiError => e
|
|
207
210
|
puts "Error when calling EmailsApi->emails_mergefile_post: #{e}"
|
|
@@ -212,12 +215,12 @@ end
|
|
|
212
215
|
|
|
213
216
|
This returns an Array which contains the response data, status code and headers.
|
|
214
217
|
|
|
215
|
-
> <Array(<EmailSend>, Integer, Hash)> emails_mergefile_post_with_http_info(merge_email_payload)
|
|
218
|
+
> <Array(<EmailSend>, Integer, Hash)> emails_mergefile_post_with_http_info(merge_email_payload, opts)
|
|
216
219
|
|
|
217
220
|
```ruby
|
|
218
221
|
begin
|
|
219
222
|
# Send Bulk Emails CSV
|
|
220
|
-
data, status_code, headers = api_instance.emails_mergefile_post_with_http_info(merge_email_payload)
|
|
223
|
+
data, status_code, headers = api_instance.emails_mergefile_post_with_http_info(merge_email_payload, opts)
|
|
221
224
|
p status_code # => 2xx
|
|
222
225
|
p headers # => { ... }
|
|
223
226
|
p data # => <EmailSend>
|
|
@@ -231,6 +234,7 @@ end
|
|
|
231
234
|
| Name | Type | Description | Notes |
|
|
232
235
|
| ---- | ---- | ----------- | ----- |
|
|
233
236
|
| **merge_email_payload** | [**MergeEmailPayload**](MergeEmailPayload.md) | Email data | |
|
|
237
|
+
| **idempotency_key** | **String** | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request. | [optional] |
|
|
234
238
|
|
|
235
239
|
### Return type
|
|
236
240
|
|
|
@@ -248,7 +252,7 @@ end
|
|
|
248
252
|
|
|
249
253
|
## emails_post
|
|
250
254
|
|
|
251
|
-
> <EmailSend> emails_post(email_message_data)
|
|
255
|
+
> <EmailSend> emails_post(email_message_data, opts)
|
|
252
256
|
|
|
253
257
|
Send Bulk Emails
|
|
254
258
|
|
|
@@ -269,10 +273,13 @@ end
|
|
|
269
273
|
|
|
270
274
|
api_instance = ElasticEmail::EmailsApi.new
|
|
271
275
|
email_message_data = ElasticEmail::EmailMessageData.new({recipients: [ElasticEmail::EmailRecipient.new({email: 'mail@example.com'})], content: ElasticEmail::EmailContent.new({from: 'John Doe <email@domain.com>'})}) # EmailMessageData | Email data
|
|
276
|
+
opts = {
|
|
277
|
+
idempotency_key: '6f1c2a7e-3b4d-4e8f-9a1b-2c3d4e5f6a7b' # String | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
278
|
+
}
|
|
272
279
|
|
|
273
280
|
begin
|
|
274
281
|
# Send Bulk Emails
|
|
275
|
-
result = api_instance.emails_post(email_message_data)
|
|
282
|
+
result = api_instance.emails_post(email_message_data, opts)
|
|
276
283
|
p result
|
|
277
284
|
rescue ElasticEmail::ApiError => e
|
|
278
285
|
puts "Error when calling EmailsApi->emails_post: #{e}"
|
|
@@ -283,12 +290,12 @@ end
|
|
|
283
290
|
|
|
284
291
|
This returns an Array which contains the response data, status code and headers.
|
|
285
292
|
|
|
286
|
-
> <Array(<EmailSend>, Integer, Hash)> emails_post_with_http_info(email_message_data)
|
|
293
|
+
> <Array(<EmailSend>, Integer, Hash)> emails_post_with_http_info(email_message_data, opts)
|
|
287
294
|
|
|
288
295
|
```ruby
|
|
289
296
|
begin
|
|
290
297
|
# Send Bulk Emails
|
|
291
|
-
data, status_code, headers = api_instance.emails_post_with_http_info(email_message_data)
|
|
298
|
+
data, status_code, headers = api_instance.emails_post_with_http_info(email_message_data, opts)
|
|
292
299
|
p status_code # => 2xx
|
|
293
300
|
p headers # => { ... }
|
|
294
301
|
p data # => <EmailSend>
|
|
@@ -302,6 +309,7 @@ end
|
|
|
302
309
|
| Name | Type | Description | Notes |
|
|
303
310
|
| ---- | ---- | ----------- | ----- |
|
|
304
311
|
| **email_message_data** | [**EmailMessageData**](EmailMessageData.md) | Email data | |
|
|
312
|
+
| **idempotency_key** | **String** | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request. | [optional] |
|
|
305
313
|
|
|
306
314
|
### Return type
|
|
307
315
|
|
|
@@ -319,7 +327,7 @@ end
|
|
|
319
327
|
|
|
320
328
|
## emails_transactional_post
|
|
321
329
|
|
|
322
|
-
> <EmailSend> emails_transactional_post(email_transactional_message_data)
|
|
330
|
+
> <EmailSend> emails_transactional_post(email_transactional_message_data, opts)
|
|
323
331
|
|
|
324
332
|
Send Transactional Email
|
|
325
333
|
|
|
@@ -340,10 +348,13 @@ end
|
|
|
340
348
|
|
|
341
349
|
api_instance = ElasticEmail::EmailsApi.new
|
|
342
350
|
email_transactional_message_data = ElasticEmail::EmailTransactionalMessageData.new({recipients: ElasticEmail::TransactionalRecipient.new({to: ['to_example']}), content: ElasticEmail::EmailContent.new({from: 'John Doe <email@domain.com>'})}) # EmailTransactionalMessageData | Email data
|
|
351
|
+
opts = {
|
|
352
|
+
idempotency_key: '6f1c2a7e-3b4d-4e8f-9a1b-2c3d4e5f6a7b' # String | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
353
|
+
}
|
|
343
354
|
|
|
344
355
|
begin
|
|
345
356
|
# Send Transactional Email
|
|
346
|
-
result = api_instance.emails_transactional_post(email_transactional_message_data)
|
|
357
|
+
result = api_instance.emails_transactional_post(email_transactional_message_data, opts)
|
|
347
358
|
p result
|
|
348
359
|
rescue ElasticEmail::ApiError => e
|
|
349
360
|
puts "Error when calling EmailsApi->emails_transactional_post: #{e}"
|
|
@@ -354,12 +365,12 @@ end
|
|
|
354
365
|
|
|
355
366
|
This returns an Array which contains the response data, status code and headers.
|
|
356
367
|
|
|
357
|
-
> <Array(<EmailSend>, Integer, Hash)> emails_transactional_post_with_http_info(email_transactional_message_data)
|
|
368
|
+
> <Array(<EmailSend>, Integer, Hash)> emails_transactional_post_with_http_info(email_transactional_message_data, opts)
|
|
358
369
|
|
|
359
370
|
```ruby
|
|
360
371
|
begin
|
|
361
372
|
# Send Transactional Email
|
|
362
|
-
data, status_code, headers = api_instance.emails_transactional_post_with_http_info(email_transactional_message_data)
|
|
373
|
+
data, status_code, headers = api_instance.emails_transactional_post_with_http_info(email_transactional_message_data, opts)
|
|
363
374
|
p status_code # => 2xx
|
|
364
375
|
p headers # => { ... }
|
|
365
376
|
p data # => <EmailSend>
|
|
@@ -373,6 +384,7 @@ end
|
|
|
373
384
|
| Name | Type | Description | Notes |
|
|
374
385
|
| ---- | ---- | ----------- | ----- |
|
|
375
386
|
| **email_transactional_message_data** | [**EmailTransactionalMessageData**](EmailTransactionalMessageData.md) | Email data | |
|
|
387
|
+
| **idempotency_key** | **String** | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request. | [optional] |
|
|
376
388
|
|
|
377
389
|
### Return type
|
|
378
390
|
|
|
@@ -179,6 +179,7 @@ module ElasticEmail
|
|
|
179
179
|
# Send to a list of contacts submitted in a CSV data file. The first column in the CSV must be the email address and the CSV must contain a header row. Additional fields can be included with a named header row and can be merged with the template using {merge} tags in the content. Example CSV: email, firstname, lastname test1@gmail.com, michael, smith test2@gmail.com, janet, smith Merge file must not be empty. Required Access Level: SendHttp
|
|
180
180
|
# @param merge_email_payload [MergeEmailPayload] Email data
|
|
181
181
|
# @param [Hash] opts the optional parameters
|
|
182
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
182
183
|
# @return [EmailSend]
|
|
183
184
|
def emails_mergefile_post(merge_email_payload, opts = {})
|
|
184
185
|
data, _status_code, _headers = emails_mergefile_post_with_http_info(merge_email_payload, opts)
|
|
@@ -189,6 +190,7 @@ module ElasticEmail
|
|
|
189
190
|
# Send to a list of contacts submitted in a CSV data file. The first column in the CSV must be the email address and the CSV must contain a header row. Additional fields can be included with a named header row and can be merged with the template using {merge} tags in the content. Example CSV: email, firstname, lastname test1@gmail.com, michael, smith test2@gmail.com, janet, smith Merge file must not be empty. Required Access Level: SendHttp
|
|
190
191
|
# @param merge_email_payload [MergeEmailPayload] Email data
|
|
191
192
|
# @param [Hash] opts the optional parameters
|
|
193
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
192
194
|
# @return [Array<(EmailSend, Integer, Hash)>] EmailSend data, response status code and response headers
|
|
193
195
|
def emails_mergefile_post_with_http_info(merge_email_payload, opts = {})
|
|
194
196
|
if @api_client.config.debugging
|
|
@@ -198,6 +200,19 @@ module ElasticEmail
|
|
|
198
200
|
if @api_client.config.client_side_validation && merge_email_payload.nil?
|
|
199
201
|
fail ArgumentError, "Missing the required parameter 'merge_email_payload' when calling EmailsApi.emails_mergefile_post"
|
|
200
202
|
end
|
|
203
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
|
|
204
|
+
fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_mergefile_post, the character length must be smaller than or equal to 255.'
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
|
|
208
|
+
fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_mergefile_post, the character length must be great than or equal to 1.'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
pattern = Regexp.new(/^[\x20-\x7E]+$/)
|
|
212
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
|
|
213
|
+
fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.emails_mergefile_post, must conform to the pattern #{pattern}."
|
|
214
|
+
end
|
|
215
|
+
|
|
201
216
|
# resource path
|
|
202
217
|
local_var_path = '/emails/mergefile'
|
|
203
218
|
|
|
@@ -213,6 +228,7 @@ module ElasticEmail
|
|
|
213
228
|
if !content_type.nil?
|
|
214
229
|
header_params['Content-Type'] = content_type
|
|
215
230
|
end
|
|
231
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
216
232
|
|
|
217
233
|
# form parameters
|
|
218
234
|
form_params = opts[:form_params] || {}
|
|
@@ -247,6 +263,7 @@ module ElasticEmail
|
|
|
247
263
|
# Send bulk merge email. Required Access Level: SendHttp
|
|
248
264
|
# @param email_message_data [EmailMessageData] Email data
|
|
249
265
|
# @param [Hash] opts the optional parameters
|
|
266
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
250
267
|
# @return [EmailSend]
|
|
251
268
|
def emails_post(email_message_data, opts = {})
|
|
252
269
|
data, _status_code, _headers = emails_post_with_http_info(email_message_data, opts)
|
|
@@ -257,6 +274,7 @@ module ElasticEmail
|
|
|
257
274
|
# Send bulk merge email. Required Access Level: SendHttp
|
|
258
275
|
# @param email_message_data [EmailMessageData] Email data
|
|
259
276
|
# @param [Hash] opts the optional parameters
|
|
277
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
260
278
|
# @return [Array<(EmailSend, Integer, Hash)>] EmailSend data, response status code and response headers
|
|
261
279
|
def emails_post_with_http_info(email_message_data, opts = {})
|
|
262
280
|
if @api_client.config.debugging
|
|
@@ -266,6 +284,19 @@ module ElasticEmail
|
|
|
266
284
|
if @api_client.config.client_side_validation && email_message_data.nil?
|
|
267
285
|
fail ArgumentError, "Missing the required parameter 'email_message_data' when calling EmailsApi.emails_post"
|
|
268
286
|
end
|
|
287
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
|
|
288
|
+
fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_post, the character length must be smaller than or equal to 255.'
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
|
|
292
|
+
fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_post, the character length must be great than or equal to 1.'
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
pattern = Regexp.new(/^[\x20-\x7E]+$/)
|
|
296
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
|
|
297
|
+
fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.emails_post, must conform to the pattern #{pattern}."
|
|
298
|
+
end
|
|
299
|
+
|
|
269
300
|
# resource path
|
|
270
301
|
local_var_path = '/emails'
|
|
271
302
|
|
|
@@ -281,6 +312,7 @@ module ElasticEmail
|
|
|
281
312
|
if !content_type.nil?
|
|
282
313
|
header_params['Content-Type'] = content_type
|
|
283
314
|
end
|
|
315
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
284
316
|
|
|
285
317
|
# form parameters
|
|
286
318
|
form_params = opts[:form_params] || {}
|
|
@@ -315,6 +347,7 @@ module ElasticEmail
|
|
|
315
347
|
# Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
|
|
316
348
|
# @param email_transactional_message_data [EmailTransactionalMessageData] Email data
|
|
317
349
|
# @param [Hash] opts the optional parameters
|
|
350
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
318
351
|
# @return [EmailSend]
|
|
319
352
|
def emails_transactional_post(email_transactional_message_data, opts = {})
|
|
320
353
|
data, _status_code, _headers = emails_transactional_post_with_http_info(email_transactional_message_data, opts)
|
|
@@ -325,6 +358,7 @@ module ElasticEmail
|
|
|
325
358
|
# Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
|
|
326
359
|
# @param email_transactional_message_data [EmailTransactionalMessageData] Email data
|
|
327
360
|
# @param [Hash] opts the optional parameters
|
|
361
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
328
362
|
# @return [Array<(EmailSend, Integer, Hash)>] EmailSend data, response status code and response headers
|
|
329
363
|
def emails_transactional_post_with_http_info(email_transactional_message_data, opts = {})
|
|
330
364
|
if @api_client.config.debugging
|
|
@@ -334,6 +368,19 @@ module ElasticEmail
|
|
|
334
368
|
if @api_client.config.client_side_validation && email_transactional_message_data.nil?
|
|
335
369
|
fail ArgumentError, "Missing the required parameter 'email_transactional_message_data' when calling EmailsApi.emails_transactional_post"
|
|
336
370
|
end
|
|
371
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
|
|
372
|
+
fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_transactional_post, the character length must be smaller than or equal to 255.'
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
|
|
376
|
+
fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_transactional_post, the character length must be great than or equal to 1.'
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
pattern = Regexp.new(/^[\x20-\x7E]+$/)
|
|
380
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
|
|
381
|
+
fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.emails_transactional_post, must conform to the pattern #{pattern}."
|
|
382
|
+
end
|
|
383
|
+
|
|
337
384
|
# resource path
|
|
338
385
|
local_var_path = '/emails/transactional'
|
|
339
386
|
|
|
@@ -349,6 +396,7 @@ module ElasticEmail
|
|
|
349
396
|
if !content_type.nil?
|
|
350
397
|
header_params['Content-Type'] = content_type
|
|
351
398
|
end
|
|
399
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
352
400
|
|
|
353
401
|
# form parameters
|
|
354
402
|
form_params = opts[:form_params] || {}
|
data/lib/ElasticEmail/version.rb
CHANGED
data/spec/api/emails_api_spec.rb
CHANGED
|
@@ -71,6 +71,7 @@ describe 'EmailsApi' do
|
|
|
71
71
|
# Send to a list of contacts submitted in a CSV data file. The first column in the CSV must be the email address and the CSV must contain a header row. Additional fields can be included with a named header row and can be merged with the template using {merge} tags in the content. Example CSV: email, firstname, lastname test1@gmail.com, michael, smith test2@gmail.com, janet, smith Merge file must not be empty. Required Access Level: SendHttp
|
|
72
72
|
# @param merge_email_payload Email data
|
|
73
73
|
# @param [Hash] opts the optional parameters
|
|
74
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
74
75
|
# @return [EmailSend]
|
|
75
76
|
describe 'emails_mergefile_post test' do
|
|
76
77
|
it 'should work' do
|
|
@@ -83,6 +84,7 @@ describe 'EmailsApi' do
|
|
|
83
84
|
# Send bulk merge email. Required Access Level: SendHttp
|
|
84
85
|
# @param email_message_data Email data
|
|
85
86
|
# @param [Hash] opts the optional parameters
|
|
87
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
86
88
|
# @return [EmailSend]
|
|
87
89
|
describe 'emails_post test' do
|
|
88
90
|
it 'should work' do
|
|
@@ -95,6 +97,7 @@ describe 'EmailsApi' do
|
|
|
95
97
|
# Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
|
|
96
98
|
# @param email_transactional_message_data Email data
|
|
97
99
|
# @param [Hash] opts the optional parameters
|
|
100
|
+
# @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
|
|
98
101
|
# @return [EmailSend]
|
|
99
102
|
describe 'emails_transactional_post test' do
|
|
100
103
|
it 'should work' do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ElasticEmail
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ElasticEmail
|
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
|
62
62
|
files:
|
|
63
63
|
- CODE_OF_CONDUCT.md
|
|
64
64
|
- CONTRIBUTING.md
|
|
65
|
+
- ElasticEmail-4.3.0.gem
|
|
65
66
|
- ElasticEmail.gemspec
|
|
66
67
|
- Gemfile
|
|
67
68
|
- LICENSE
|