brevo-rails 0.0.6.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/brevo_rails/mail.rb +1 -0
- data/lib/brevo_rails/version.rb +1 -1
- data/spec/brevo_rails/mail_spec.rb +25 -10
- 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: 50bf8df6dd85488aa2e1d982cd4f58d2e9747d115b649e2c007fe8a556a97b33
|
4
|
+
data.tar.gz: 1775143e55c39cb9104e6373ef79b82a5b463eebf2956ad76f500570c1e4091f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 291362cde146bdf7c9006271fe7bfafe3559c54dd849e2b5a67125ae4021fd0d5c929fd653111eecd6979d355639a912519887feb645873c1ad5dfc68d9b220b
|
7
|
+
data.tar.gz: b8b8d26599162ab3276b8245e9e7bfd453d918a491b60251d783c022d16d7c781b41522fc630f2e4bb42f31e19fbbbb7d6c5d238929214c58ddff8187c50a1ba
|
data/README.md
CHANGED
@@ -21,4 +21,17 @@ config.action_mailer.brevo_settings = {
|
|
21
21
|
}
|
22
22
|
```
|
23
23
|
|
24
|
+
Send an email with tags
|
25
|
+
|
26
|
+
```
|
27
|
+
def method
|
28
|
+
mail(
|
29
|
+
from: 'me@example.com',
|
30
|
+
to: 'you@example.com',
|
31
|
+
subject: 'Hello there!',
|
32
|
+
tags: ['tag1', 'tag2'],
|
33
|
+
)
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
24
37
|
|
data/lib/brevo_rails/mail.rb
CHANGED
@@ -20,6 +20,7 @@ module BrevoRails
|
|
20
20
|
params['cc'] = prepare_cc(address_list(message['cc'])&.addresses) if message['cc']
|
21
21
|
params['bcc'] = prepare_bcc(address_list(message['bcc'])&.addresses) if message['bcc']
|
22
22
|
params['attachment'] = prepare_attachments(message.attachments) if message.attachments.any?
|
23
|
+
params['tags'] = message['tags']&.unparsed_value if message['tags']
|
23
24
|
|
24
25
|
Brevo::SendSmtpEmail.new(params)
|
25
26
|
end
|
data/lib/brevo_rails/version.rb
CHANGED
@@ -24,15 +24,6 @@ RSpec.describe BrevoRails::Mail do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
let(:message_with_attachments) do
|
28
|
-
Mail.new do
|
29
|
-
from 'Tester <test@example.com>'
|
30
|
-
to 'you@example.com, her@example.com'
|
31
|
-
subject 'This is a test email'
|
32
|
-
headers 'X-Custom-Header' => 'Custom Value'
|
33
|
-
attachments['test.png'] = File.read('spec/fixtures/test.png')
|
34
|
-
end
|
35
|
-
end
|
36
27
|
|
37
28
|
before do
|
38
29
|
message.text_part = text_part
|
@@ -73,11 +64,20 @@ RSpec.describe BrevoRails::Mail do
|
|
73
64
|
expect(custom_header).to eq('Custom Value')
|
74
65
|
end
|
75
66
|
|
76
|
-
it '
|
67
|
+
it 'does not set attachments' do
|
77
68
|
expect(subject.attachment).to be_nil
|
78
69
|
end
|
79
70
|
|
80
71
|
context 'with attachments' do
|
72
|
+
let(:message_with_attachments) do
|
73
|
+
Mail.new do
|
74
|
+
from 'Tester <test@example.com>'
|
75
|
+
to 'you@example.com, her@example.com'
|
76
|
+
subject 'This is a test email'
|
77
|
+
attachments['test.png'] = File.read('spec/fixtures/test.png')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
81
|
subject { BrevoRails::Mail.from_message(message_with_attachments) }
|
82
82
|
|
83
83
|
it 'sets attachments' do
|
@@ -87,5 +87,20 @@ RSpec.describe BrevoRails::Mail do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
context 'with tags' do
|
91
|
+
let(:message_with_tags) do
|
92
|
+
Mail.new(from: 'Tester <test@example.com>',
|
93
|
+
to: 'you@example.com, her@example.com',
|
94
|
+
subject: 'This is a test email',
|
95
|
+
tags: ['tag1', 'tag2'])
|
96
|
+
end
|
97
|
+
|
98
|
+
subject { BrevoRails::Mail.from_message(message_with_tags) }
|
99
|
+
|
100
|
+
it 'sets tags' do
|
101
|
+
expect(subject.tags).to eq(['tag1', 'tag2'])
|
102
|
+
end
|
103
|
+
end
|
90
104
|
end
|
105
|
+
|
91
106
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brevo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franck D'agostini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|