customerio-rails 0.2.2 → 0.3.1

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: 89e736882d200a4d1285d1172b0a69bebd2b296189dd97381d4a9ac8ac998523
4
- data.tar.gz: f5c69c0c71d4090da1035f7c0faa13ea03afa355798fcb1bdcda6b05836e93d6
3
+ metadata.gz: 5976c4249ab4c103d9e74589a7451210152250783361a3d61d904d4f27c835e0
4
+ data.tar.gz: 4471a05e60b2be91cbdd88b0348d226e7960bab49c419baddeef566fccf7addc
5
5
  SHA512:
6
- metadata.gz: b4639bc1ba882ebd9a49d95f0571579a1af4eebf17596660ee4f488f261bdeee05515737fa471182ec7f3c5b063afb64f3fa6babb37833c03fa18aa7dd49ff5d
7
- data.tar.gz: b171efc85d282dc29480074a3179184ec0451868993937484cf71874ce060d3f66b848a31062413e534245333b8661028589a418fa78e8c0b64c244c9bd471ec
6
+ metadata.gz: 9d71b70e8bae1654eafe6520e38bf094dd585580a3bef2bc82ae6d62ea1cb5dee5a644fdc7ebde55f37d189547f2de5a2249c8ede1339179fcbc541535de25c5
7
+ data.tar.gz: 281e656095945b568f1caa2b5caa1cf3f51018282e532e3314e69e0d630b074a53aa1171e1b55ae423ac4528254497be4c641267a32073c11278b216748fcd34
@@ -18,11 +18,12 @@ module CustomerioRails
18
18
  to: to,
19
19
  from: Array.wrap(mail[:from]).first.unparsed_value,
20
20
  subject: mail.subject,
21
- reply_to: mail.reply_to,
21
+ reply_to: mail.reply_to&.join(','),
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 || {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CustomerioRails
4
- VERSION = '0.2.2'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -30,7 +30,7 @@ describe 'Delivering messages with customerio-rails' do
30
30
 
31
31
  context 'with a reply-to address' do
32
32
  let(:expected_body) do
33
- super().merge('reply_to' => ['raj@bigbangtheory.com'])
33
+ super().merge('reply_to' => 'raj@bigbangtheory.com')
34
34
  end
35
35
 
36
36
  it do
@@ -39,6 +39,17 @@ describe 'Delivering messages with customerio-rails' do
39
39
  end
40
40
  end
41
41
 
42
+ context 'with multiple reply-to addresses' do
43
+ let(:expected_body) do
44
+ super().merge('reply_to' => 'raj@bigbangtheory.com,raj2@bigbangtheory.com')
45
+ end
46
+
47
+ it do
48
+ message.reply_to = ['raj@bigbangtheory.com', 'raj2@bigbangtheory.com']
49
+ message.deliver!
50
+ end
51
+ end
52
+
42
53
  context 'with a bcc address' do
43
54
  let(:expected_body) do
44
55
  super().merge('bcc' => ['raj@bigbangtheory.com'])
@@ -135,4 +146,31 @@ describe 'Delivering messages with customerio-rails' do
135
146
  message.deliver!
136
147
  end
137
148
  end
149
+
150
+ context 'when delivering a message without tracking' do
151
+ let(:message) { TestMailer.message_without_tracked }
152
+
153
+ let(:expected_body) do
154
+ { "to" => "sheldon@bigbangtheory.com", "from" => "leonard@bigbangtheory.com", "subject" => "Message without tracking.", "headers" => {},
155
+ "identifiers" => {"email" => "sheldon@bigbangtheory.com"}, "tracked" => false, "body" => "", "body_plain" => "whatever", "attachments" => {} }
156
+ end
157
+
158
+ it do
159
+ message.deliver!
160
+ end
161
+ end
162
+
163
+
164
+ context 'when delivering a message with tracking' do
165
+ let(:message) { TestMailer.message_with_tracked }
166
+
167
+ let(:expected_body) do
168
+ { "to" => "sheldon@bigbangtheory.com", "from" => "leonard@bigbangtheory.com", "subject" => "Message without tracking.", "headers" => {},
169
+ "identifiers" => {"email" => "sheldon@bigbangtheory.com"}, "tracked" => true, "body" => "", "body_plain" => "whatever", "attachments" => {} }
170
+ end
171
+
172
+ it do
173
+ message.deliver!
174
+ end
175
+ end
138
176
  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
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: customerio-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Utard
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-16 00:00:00.000000000 Z
10
+ date: 2025-05-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionmailer