resend 0.17.1 → 0.18.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/lib/resend/contacts.rb +11 -1
- data/lib/resend/mailer.rb +7 -2
- data/lib/resend/request.rb +1 -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: 81c1365c2d9349d09a02ef4794693b7af091032572096308d9f0fd26b49f4cc0
|
4
|
+
data.tar.gz: 665e7731c7fc7e8a2dde7c2d9dac410411f98aa3875cb3fa7ba4482b1fa8ff9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba0ff3dfdabfc35154b7c54a259eae9e2f34a053f327c940bcc13844995aa56d1a654605656f5a56b6732f543a238b207522636932e4fb4a707933065925740b
|
7
|
+
data.tar.gz: fc8240192183768510aff96e175c5c1fd329dfe23d5b6623b7e89529e1fafe6c6d2726335b34d81d13e275b2c6bcd38b27d0a65a98f891c808b6cede2bf0c0ec
|
data/lib/resend/contacts.rb
CHANGED
@@ -19,6 +19,10 @@ module Resend
|
|
19
19
|
Resend::Request.new(path, {}, "get").perform
|
20
20
|
end
|
21
21
|
|
22
|
+
#
|
23
|
+
# List contacts in an audience
|
24
|
+
#
|
25
|
+
# @param audience_id [String] the audience id
|
22
26
|
# https://resend.com/docs/api-reference/contacts/list-contacts
|
23
27
|
def list(audience_id)
|
24
28
|
path = "audiences/#{audience_id}/contacts"
|
@@ -37,9 +41,15 @@ module Resend
|
|
37
41
|
Resend::Request.new(path, {}, "delete").perform
|
38
42
|
end
|
39
43
|
|
44
|
+
#
|
45
|
+
# Update a contact
|
46
|
+
#
|
47
|
+
# @param params [Hash] the contact params
|
40
48
|
# https://resend.com/docs/api-reference/contacts/update-contact
|
41
49
|
def update(params)
|
42
|
-
|
50
|
+
raise ArgumentError, "id or email is required" if params[:id].nil? && params[:email].nil?
|
51
|
+
|
52
|
+
path = "audiences/#{params[:audience_id]}/contacts/#{params[:id] || params[:email]}"
|
43
53
|
Resend::Request.new(path, params, "patch").perform
|
44
54
|
end
|
45
55
|
end
|
data/lib/resend/mailer.rb
CHANGED
@@ -92,6 +92,11 @@ module Resend
|
|
92
92
|
params
|
93
93
|
end
|
94
94
|
|
95
|
+
# Remove nils from header values
|
96
|
+
def cleanup_headers(headers)
|
97
|
+
headers.delete_if { |_k, v| v.nil? }
|
98
|
+
end
|
99
|
+
|
95
100
|
# Gets the values of the headers that are set through the `#mail` method
|
96
101
|
#
|
97
102
|
# @param Mail mail Rails Mail object
|
@@ -101,6 +106,7 @@ module Resend
|
|
101
106
|
mail[:headers].unparsed_value.each do |k, v|
|
102
107
|
params[k.to_s] = v
|
103
108
|
end
|
109
|
+
cleanup_headers(params)
|
104
110
|
params
|
105
111
|
end
|
106
112
|
|
@@ -113,8 +119,7 @@ module Resend
|
|
113
119
|
unignored_headers(mail).each do |h|
|
114
120
|
params[h.name.to_s] = h.unparsed_value
|
115
121
|
end
|
116
|
-
|
117
|
-
params.delete_if { |_k, v| v.nil? }
|
122
|
+
cleanup_headers(params)
|
118
123
|
params
|
119
124
|
end
|
120
125
|
|
data/lib/resend/request.rb
CHANGED
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.18.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-01-
|
11
|
+
date: 2025-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|