brevo-rails 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f38c8e0d586324f814cc56cc4d4e15e3bfc25f8bad4825910ed3cd6d3a3d0d48
4
- data.tar.gz: 563e8f88f66b57c3484d22630315f7e41816251d2d9c6f3d4654689ce3b540c0
3
+ metadata.gz: 50bf8df6dd85488aa2e1d982cd4f58d2e9747d115b649e2c007fe8a556a97b33
4
+ data.tar.gz: 1775143e55c39cb9104e6373ef79b82a5b463eebf2956ad76f500570c1e4091f
5
5
  SHA512:
6
- metadata.gz: 216694871f682f0dfeb9adf44f8601c6caa6d496aabb3cacf90f47a8c141efa101669a4ad9ce91a69c5cae6ba6f427ff2aadfbb66dc7ef3bcf8a3b1e939a7629
7
- data.tar.gz: dd25cde5e9364be90405b4adee32de1a94e4aa64d635170ee25135701856ce76456d20952d2b67ea76a0a9b8c49210db986d3d97c161d987150825d88d897b16
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
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrevoRails
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -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 'sets attachments' do
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brevo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franck D'agostini