resend 0.24.0 → 0.25.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/README.md +1 -1
- data/lib/resend/batch.rb +21 -0
- data/lib/resend/request.rb +9 -0
- data/lib/resend/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58501f77e4e315fec8185ee1a1b74942d0daa553ba4d13275e8efb0729780225
|
4
|
+
data.tar.gz: ee0215aa0aa03241b817625736e26e99ff9c6194e19ff304b1cd0f12824bcd50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f37730c78b2579ac2bf6b739504a20d6e6472430c4614a9ec22cedb134d5f19f440106f2f2c9d615eff4198e8be19292d10953a8af1e463a1465dc2051f68d76
|
7
|
+
data.tar.gz: 68e4d7b0dc34700c1ddfee321f466f5a5f49319049cc2d54cb53a69063478941afab35907f9c66085caf56b96247bdf8da461117d677bdcae2898c8335cd019e
|
data/README.md
CHANGED
@@ -72,7 +72,7 @@ puts r
|
|
72
72
|
|
73
73
|
You can view all the examples in the [examples folder](https://github.com/drish/resend-ruby/tree/main/examples)
|
74
74
|
|
75
|
-
# Rails and
|
75
|
+
# Rails and ActionMailer support
|
76
76
|
|
77
77
|
This gem can be used as an ActionMailer delivery method, add this to your `config/environments/environment.rb` file.
|
78
78
|
|
data/lib/resend/batch.rb
CHANGED
@@ -4,6 +4,27 @@ module Resend
|
|
4
4
|
# Module responsible for wrapping Batch email sending API
|
5
5
|
module Batch
|
6
6
|
class << self
|
7
|
+
# Send a batch of emails
|
8
|
+
#
|
9
|
+
# @param params [Array<Hash>] Array of email parameters (max 100 emails)
|
10
|
+
# @param options [Hash] Additional options for the request
|
11
|
+
# @option options [String] :idempotency_key Optional idempotency key
|
12
|
+
# @option options [String] :batch_validation Batch validation mode: "strict" (default) or "permissive"
|
13
|
+
# - "strict": Entire batch fails if any email is invalid
|
14
|
+
# - "permissive": Sends valid emails and returns errors for invalid ones
|
15
|
+
#
|
16
|
+
# @return [Hash] Response with :data array and optional :errors array (in permissive mode)
|
17
|
+
#
|
18
|
+
# @example Send batch with strict validation (default)
|
19
|
+
# Resend::Batch.send([
|
20
|
+
# { from: "sender@example.com", to: ["recipient@example.com"], subject: "Hello", html: "<p>Hi</p>" }
|
21
|
+
# ])
|
22
|
+
#
|
23
|
+
# @example Send batch with permissive validation
|
24
|
+
# response = Resend::Batch.send(emails, options: { batch_validation: "permissive" })
|
25
|
+
# # response[:data] contains successful email IDs
|
26
|
+
# # response[:errors] contains validation errors with index and message
|
27
|
+
#
|
7
28
|
# https://resend.com/docs/api-reference/emails/send-batch-emails
|
8
29
|
def send(params = [], options: {})
|
9
30
|
path = "emails/batch"
|
data/lib/resend/request.rb
CHANGED
@@ -25,6 +25,7 @@ module Resend
|
|
25
25
|
}
|
26
26
|
|
27
27
|
set_idempotency_key
|
28
|
+
set_batch_validation
|
28
29
|
end
|
29
30
|
|
30
31
|
# Performs the HTTP call
|
@@ -66,6 +67,14 @@ module Resend
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
70
|
+
def set_batch_validation
|
71
|
+
# Set x-batch-validation header for batch emails
|
72
|
+
# Supported values: 'strict' (default) or 'permissive'
|
73
|
+
if @path == "emails/batch" && @options[:batch_validation]
|
74
|
+
@headers["x-batch-validation"] = @options[:batch_validation]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
69
78
|
def check_json!(resp)
|
70
79
|
if resp.body.is_a?(Hash)
|
71
80
|
JSON.parse(resp.body.to_json)
|
data/lib/resend/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derich Pacheco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|