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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17fbcff646b3034847bea36e37e12f63a8654fd38cdc66da8fd935704d613250
4
- data.tar.gz: 4a5105290aa022dd5e72ef6e546294dd23c50d7dc7fb1458c40c51ac679517d8
3
+ metadata.gz: 58501f77e4e315fec8185ee1a1b74942d0daa553ba4d13275e8efb0729780225
4
+ data.tar.gz: ee0215aa0aa03241b817625736e26e99ff9c6194e19ff304b1cd0f12824bcd50
5
5
  SHA512:
6
- metadata.gz: c469989bed973379461c1b93a837f7acd8f1a6cfceac4007f49cf9215189307faed7018cf7fd6adba389af9cfffacda93bc434aba1c739452f58a75f042b19b4
7
- data.tar.gz: 590552f7916c9b870fbaed5f54ebbb35652aa3bf8a9b332c020d1e77345c2020ba61fa8f95fc6943f0d2e3ded9907f99a9c9507a3eb76b6a5721dd37fc97507a
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 ActiveMailer support
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"
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Resend
4
- VERSION = "0.24.0"
4
+ VERSION = "0.25.0"
5
5
  end
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.24.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-08-13 00:00:00.000000000 Z
11
+ date: 2025-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty