customerio-rails 0.2.0 → 0.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5adee29125bb8586d4fda950db62af40292c31a993a1690b839ca4e24f17671a
|
4
|
+
data.tar.gz: 92f387d08d78fdd31a460687a29f28c1e019d954c590da6b2390f1f1b5962215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28b9efc02aa6df47a7cafdaa332ad6f4afa858c14ee6d7ce435a4d275f099120e9c9211605f721d2d3ec75ef9d4268a2de235cb8fdc9af822dc25f35a865d4a
|
7
|
+
data.tar.gz: 5f287d2ca36b4bfef0f163b600a603d0369d761f85b8dc35a57ef8c69b3465e57955fedf6e7df8a9257a0c62ee90a4c6309044c2c58b2f352a24e8daab53075a
|
@@ -27,8 +27,9 @@ module CustomerioRails
|
|
27
27
|
params[:transactional_message_id] = mail[:transactional_message_id].unparsed_value
|
28
28
|
params[:message_data] = mail[:message_data]&.unparsed_value || {}
|
29
29
|
else
|
30
|
-
params[:body] = mail.html_part
|
31
|
-
params[:body_plain] = mail.text_part
|
30
|
+
params[:body] = mail.html_part.body.to_s if mail.html_part
|
31
|
+
params[:body_plain] = mail.text_part.body.to_s if mail.text_part
|
32
|
+
params[mail.text? ? :body_plain : :body] = mail.body.to_s if !mail.html_part && !mail.text_part
|
32
33
|
end
|
33
34
|
request = ::Customerio::SendEmailRequest.new(params.compact)
|
34
35
|
mail.attachments.each do |attachment|
|
data/spec/delivery_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe 'Delivering messages with customerio-rails' do
|
|
19
19
|
context 'when delivering a simple message' do
|
20
20
|
let(:expected_body) do
|
21
21
|
{ 'to' => 'sheldon@bigbangtheory.com', 'from' => 'leonard@bigbangtheory.com', 'subject' => 'hello',
|
22
|
-
'
|
22
|
+
'body_plain' => "hello\n", 'headers' => {}, 'identifiers' => { 'email' => 'sheldon@bigbangtheory.com' }, 'attachments' => {} }
|
23
23
|
end
|
24
24
|
|
25
25
|
let(:message) { TestMailer.simple_message }
|
@@ -65,7 +65,7 @@ describe 'Delivering messages with customerio-rails' do
|
|
65
65
|
context 'when delivering with a nice from address' do
|
66
66
|
let(:expected_body) do
|
67
67
|
{"to" => "sheldon@bigbangtheory.com", "from" => "Leonard Hofstadter <leonard@bigbangtheory.com>",
|
68
|
-
"subject" => "hello", "headers" => {}, "identifiers" => {"email" => "sheldon@bigbangtheory.com"}, "
|
68
|
+
"subject" => "hello", "headers" => {}, "identifiers" => {"email" => "sheldon@bigbangtheory.com"}, "body_plain" => "hello", "attachments" => {}}
|
69
69
|
end
|
70
70
|
|
71
71
|
it do
|
@@ -86,6 +86,18 @@ describe 'Delivering messages with customerio-rails' do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
context 'when delivering a single part message' do
|
90
|
+
let(:expected_body) do
|
91
|
+
{ 'to' => 'sheldon@bigbangtheory.com', 'from' => 'leonard@bigbangtheory.com',
|
92
|
+
'subject' => 'Your invitation to join Mixlr.', "body_plain" => "hello\n", 'headers' => {}, 'identifiers' => { 'email' => 'sheldon@bigbangtheory.com' }, 'attachments' => {} }
|
93
|
+
end
|
94
|
+
|
95
|
+
it do
|
96
|
+
message = TestMailer.singlepart_message
|
97
|
+
message.deliver!
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
89
101
|
context 'when delivering a message with attachments' do
|
90
102
|
let(:expected_body) do
|
91
103
|
{ 'to' => 'sheldon@bigbangtheory.com', 'from' => 'leonard@bigbangtheory.com',
|
@@ -18,6 +18,10 @@ class TestMailer < ActionMailer::Base
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def singlepart_message
|
22
|
+
mail(subject: "Your invitation to join Mixlr.")
|
23
|
+
end
|
24
|
+
|
21
25
|
def message_with_attachment
|
22
26
|
attachments['empty.gif'] = File.read(image_file)
|
23
27
|
mail(subject: "Message with attachment.")
|
@@ -0,0 +1 @@
|
|
1
|
+
hello
|
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.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Utard
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-05-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: actionmailer
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- spec/fixtures/views/test_mailer/multipart_message.html.erb
|
75
75
|
- spec/fixtures/views/test_mailer/multipart_message.text.erb
|
76
76
|
- spec/fixtures/views/test_mailer/simple_message.erb
|
77
|
+
- spec/fixtures/views/test_mailer/singlepart_message.text.erb
|
77
78
|
- spec/spec.opts
|
78
79
|
- spec/spec_helper.rb
|
79
80
|
homepage: https://github.com/altertable-ai/customerio-rails
|
@@ -107,5 +108,6 @@ test_files:
|
|
107
108
|
- spec/fixtures/views/test_mailer/multipart_message.html.erb
|
108
109
|
- spec/fixtures/views/test_mailer/multipart_message.text.erb
|
109
110
|
- spec/fixtures/views/test_mailer/simple_message.erb
|
111
|
+
- spec/fixtures/views/test_mailer/singlepart_message.text.erb
|
110
112
|
- spec/spec.opts
|
111
113
|
- spec/spec_helper.rb
|