customerio-rails 0.2.2 → 0.3.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/customerio-rails/mail.rb +2 -1
- data/lib/customerio-rails/version.rb +1 -1
- data/spec/delivery_spec.rb +27 -0
- data/spec/fixtures/models/test_mailer.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f61734cc94dee78031fa7d1737b8fc4add5d600924714a54dd0dffeeb3d79922
|
4
|
+
data.tar.gz: 16e2e3011627b8331a6efac3452390b46736bf8d164177f5208eb3edf16da1c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0849f2c2c8dfd524e203c7cfae32fd7a81d76069b3b5cac94f9c5080be83319aecafca309fc072d0b72aef932805029687659152cbb53b4579481ecc26731ac9'
|
7
|
+
data.tar.gz: '079842f178dc0042cea0fc27e0c43720437957056b2f807e54cae3260f84f8ba673b6ddf99a2a477caaec1cb3a3026f73b257cc75939e966785d7fdd74372d72'
|
@@ -21,8 +21,9 @@ module CustomerioRails
|
|
21
21
|
reply_to: mail.reply_to,
|
22
22
|
bcc: mail.bcc,
|
23
23
|
headers: mail.headers,
|
24
|
-
identifiers: { email: to }
|
24
|
+
identifiers: { email: to }
|
25
25
|
}
|
26
|
+
params[:tracked] = mail[:tracked].unparsed_value == true unless mail[:tracked].nil?
|
26
27
|
if mail[:transactional_message_id]
|
27
28
|
params[:transactional_message_id] = mail[:transactional_message_id].unparsed_value
|
28
29
|
params[:message_data] = mail[:message_data]&.unparsed_value || {}
|
data/spec/delivery_spec.rb
CHANGED
@@ -135,4 +135,31 @@ describe 'Delivering messages with customerio-rails' do
|
|
135
135
|
message.deliver!
|
136
136
|
end
|
137
137
|
end
|
138
|
+
|
139
|
+
context 'when delivering a message without tracking' do
|
140
|
+
let(:message) { TestMailer.message_without_tracked }
|
141
|
+
|
142
|
+
let(:expected_body) do
|
143
|
+
{ "to" => "sheldon@bigbangtheory.com", "from" => "leonard@bigbangtheory.com", "subject" => "Message without tracking.", "headers" => {},
|
144
|
+
"identifiers" => {"email" => "sheldon@bigbangtheory.com"}, "tracked" => false, "body" => "", "body_plain" => "whatever", "attachments" => {} }
|
145
|
+
end
|
146
|
+
|
147
|
+
it do
|
148
|
+
message.deliver!
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
context 'when delivering a message with tracking' do
|
154
|
+
let(:message) { TestMailer.message_with_tracked }
|
155
|
+
|
156
|
+
let(:expected_body) do
|
157
|
+
{ "to" => "sheldon@bigbangtheory.com", "from" => "leonard@bigbangtheory.com", "subject" => "Message without tracking.", "headers" => {},
|
158
|
+
"identifiers" => {"email" => "sheldon@bigbangtheory.com"}, "tracked" => true, "body" => "", "body_plain" => "whatever", "attachments" => {} }
|
159
|
+
end
|
160
|
+
|
161
|
+
it do
|
162
|
+
message.deliver!
|
163
|
+
end
|
164
|
+
end
|
138
165
|
end
|
@@ -41,6 +41,14 @@ class TestMailer < ActionMailer::Base
|
|
41
41
|
mail(subject: 'Message with template.', transactional_message_id: '123', message_data: { foo: 'bar' })
|
42
42
|
end
|
43
43
|
|
44
|
+
def message_with_tracked
|
45
|
+
mail(subject: 'Message without tracking.', tracked: true, body: 'whatever')
|
46
|
+
end
|
47
|
+
|
48
|
+
def message_without_tracked
|
49
|
+
mail(subject: 'Message without tracking.', tracked: false, body: 'whatever')
|
50
|
+
end
|
51
|
+
|
44
52
|
protected
|
45
53
|
|
46
54
|
def image_file
|