sparkpost_rails 1.0.1 → 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 +99 -14
- data/lib/sparkpost_rails.rb +11 -0
- data/lib/sparkpost_rails/delivery_method.rb +175 -20
- data/lib/sparkpost_rails/version.rb +1 -1
- data/spec/attachments_spec.rb +52 -0
- data/spec/bcc_recipients_spec.rb +81 -0
- data/spec/campaign_id_spec.rb +64 -0
- data/spec/cc_recipients_spec.rb +98 -0
- data/spec/click_tracking_spec.rb +54 -0
- data/spec/{content_spec.rb → inline_content_spec.rb} +9 -1
- data/spec/open_tracking_spec.rb +54 -0
- data/spec/recipients_list_spec.rb +34 -0
- data/spec/return_path_spec.rb +50 -0
- data/spec/sandbox_mode_spec.rb +53 -0
- data/spec/spec_helper.rb +28 -1
- data/spec/substitution_data_spec.rb +40 -0
- data/spec/template_spec.rb +36 -0
- metadata +28 -8
- data/spec/options_spec.rb +0 -69
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SparkPostRails::DeliveryMethod do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
SparkPostRails.configuration.set_defaults
|
7
|
+
@delivery_method = SparkPostRails::DeliveryMethod.new
|
8
|
+
end
|
9
|
+
|
10
|
+
context "Sandbox Mode" do
|
11
|
+
it "handles sandbox mode enabled in the configuration" do
|
12
|
+
SparkPostRails.configure do |c|
|
13
|
+
c.sandbox = true
|
14
|
+
end
|
15
|
+
|
16
|
+
test_email = Mailer.test_email
|
17
|
+
|
18
|
+
@delivery_method.deliver!(test_email)
|
19
|
+
|
20
|
+
expect(@delivery_method.data[:options][:sandbox]).to eq(true)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "handles sandbox mode enabled on an individual message" do
|
24
|
+
test_email = Mailer.test_email sparkpost_data: {sandbox: true}
|
25
|
+
|
26
|
+
@delivery_method.deliver!(test_email)
|
27
|
+
|
28
|
+
expect(@delivery_method.data[:options][:sandbox]).to eq(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "handles the value on an individual message overriding configuration" do
|
32
|
+
SparkPostRails.configure do |c|
|
33
|
+
c.sandbox = true
|
34
|
+
end
|
35
|
+
|
36
|
+
test_email = Mailer.test_email sparkpost_data: {sandbox: false}
|
37
|
+
|
38
|
+
@delivery_method.deliver!(test_email)
|
39
|
+
|
40
|
+
expect(@delivery_method.data[:options].has_key?(:sandbox)).to eq(false)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "handles a default setting of 'false'" do
|
44
|
+
test_email = Mailer.test_email
|
45
|
+
|
46
|
+
@delivery_method.deliver!(test_email)
|
47
|
+
|
48
|
+
expect(@delivery_method.data[:options].has_key?(:sandbox)).to eq(false)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -28,6 +28,30 @@ class Mailer < ActionMailer::Base
|
|
28
28
|
text_part: "Hello, Testing!"
|
29
29
|
}
|
30
30
|
|
31
|
+
if options.has_key?(:attachments)
|
32
|
+
options[:attachments].times do |i|
|
33
|
+
attachments["file_#{i}.txt"] = "This is file #{i}"
|
34
|
+
end
|
35
|
+
|
36
|
+
options.delete(:attachments)
|
37
|
+
end
|
38
|
+
|
39
|
+
if options.has_key?(:images)
|
40
|
+
options[:images].times do |i|
|
41
|
+
attachments["image_#{i}.png"] = sparkpost_logo_contents
|
42
|
+
end
|
43
|
+
|
44
|
+
options.delete(:images)
|
45
|
+
end
|
46
|
+
|
47
|
+
if options.has_key?(:inline_attachments)
|
48
|
+
options[:inline_attachments].times do |i|
|
49
|
+
attachments.inline["image_#{i}.png"] = sparkpost_logo_contents
|
50
|
+
end
|
51
|
+
|
52
|
+
options.delete(:inline_attachments)
|
53
|
+
end
|
54
|
+
|
31
55
|
data.merge! options
|
32
56
|
|
33
57
|
if data.has_key?(:html_part)
|
@@ -44,7 +68,10 @@ class Mailer < ActionMailer::Base
|
|
44
68
|
end
|
45
69
|
|
46
70
|
end
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X\nTmEY4xfIufdgjZrINdBNPuxDnhuhL81u5iJH0y5cE4oGFfKi5zOH+I+NRIpk\nqJ+50Sc1x7mjU5rkyHtyI5suEYjcaNO+sO8po5eqRE5XZmelPo+O/J00fVZM\nCh2R0iRGHi1EeYQ8jBHkxjHtmYkcN6N81CEvOhET/do+SolLR/4AoD4RKg7h\nfp/Vbl1qnsOdGj5ZDvfivMRQaTGGexFPKi2ZTZeATe8a54NCL9fGKn7k8Hi4\nytu5GXBsdkbe86vDB63+6Pl42QLOz3tKXzjyHwC/TfqZfgXg/yj90dPb6kD1\n/Q+Af77e/0v98vny/zLB/+j0+vl5PP1uAP8CV/GqdTJ4tWwAAAAASUVORK5C\nYII=\n"
|
75
|
+
Base64.decode64(encoded_contents)
|
49
76
|
end
|
50
77
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SparkPostRails::DeliveryMethod do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@delivery_method = SparkPostRails::DeliveryMethod.new
|
7
|
+
end
|
8
|
+
|
9
|
+
context "Substitution Data" do
|
10
|
+
|
11
|
+
it "accepts substitution data with template-based message" do
|
12
|
+
sub_data = {item_1: "test data 1", item_2: "test data 2"}
|
13
|
+
|
14
|
+
test_email = Mailer.test_email sparkpost_data: {template_id: "test_template", substitution_data: sub_data}
|
15
|
+
|
16
|
+
@delivery_method.deliver!(test_email)
|
17
|
+
|
18
|
+
expect(@delivery_method.data[:substitution_data]).to eq(sub_data)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "accepts substitution data with inline-content message" do
|
22
|
+
sub_data = {item_1: "test data 1", item_2: "test data 2"}
|
23
|
+
|
24
|
+
test_email = Mailer.test_email sparkpost_data: {substitution_data: sub_data}
|
25
|
+
|
26
|
+
@delivery_method.deliver!(test_email)
|
27
|
+
|
28
|
+
expect(@delivery_method.data[:substitution_data]).to eq(sub_data)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "does not include substitution data element if none is passed" do
|
32
|
+
test_email = Mailer.test_email sparkpost_data: {template_id: "test_template"}
|
33
|
+
@delivery_method.deliver!(test_email)
|
34
|
+
|
35
|
+
expect(@delivery_method.data.has_key?(:substitution_data)).to eq(false)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SparkPostRails::DeliveryMethod do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@delivery_method = SparkPostRails::DeliveryMethod.new
|
7
|
+
end
|
8
|
+
|
9
|
+
context "Templates" do
|
10
|
+
|
11
|
+
it "accepts the template id to use" do
|
12
|
+
test_email = Mailer.test_email sparkpost_data: {template_id: "test_template"}
|
13
|
+
|
14
|
+
@delivery_method.deliver!(test_email)
|
15
|
+
|
16
|
+
expect(@delivery_method.data[:content][:template_id]).to eq("test_template")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "does not include inline content elements" do
|
20
|
+
test_email = Mailer.test_email sparkpost_data: {template_id: "test_template"}
|
21
|
+
|
22
|
+
@delivery_method.deliver!(test_email)
|
23
|
+
|
24
|
+
expect(@delivery_method.data[:content].has_key?(:from)).to eq(false)
|
25
|
+
expect(@delivery_method.data[:content].has_key?(:reply_to)).to eq(false)
|
26
|
+
|
27
|
+
expect(@delivery_method.data[:content].has_key?(:subject)).to eq(false)
|
28
|
+
|
29
|
+
expect(@delivery_method.data[:content].has_key?(:html)).to eq(false)
|
30
|
+
expect(@delivery_method.data[:content].has_key?(:text)).to eq(false)
|
31
|
+
expect(@delivery_method.data[:content].has_key?(:attachments)).to eq(false)
|
32
|
+
expect(@delivery_method.data[:content].has_key?(:inline_images)).to eq(false)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparkpost_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Kimball
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -69,13 +69,23 @@ files:
|
|
69
69
|
- lib/sparkpost_rails/exceptions.rb
|
70
70
|
- lib/sparkpost_rails/railtie.rb
|
71
71
|
- lib/sparkpost_rails/version.rb
|
72
|
-
- spec/
|
72
|
+
- spec/attachments_spec.rb
|
73
|
+
- spec/bcc_recipients_spec.rb
|
74
|
+
- spec/campaign_id_spec.rb
|
75
|
+
- spec/cc_recipients_spec.rb
|
76
|
+
- spec/click_tracking_spec.rb
|
73
77
|
- spec/from_spec.rb
|
74
|
-
- spec/
|
78
|
+
- spec/inline_content_spec.rb
|
79
|
+
- spec/open_tracking_spec.rb
|
80
|
+
- spec/recipients_list_spec.rb
|
75
81
|
- spec/recipients_spec.rb
|
76
82
|
- spec/reply_to_spec.rb
|
77
83
|
- spec/response_spec.rb
|
84
|
+
- spec/return_path_spec.rb
|
85
|
+
- spec/sandbox_mode_spec.rb
|
78
86
|
- spec/spec_helper.rb
|
87
|
+
- spec/substitution_data_spec.rb
|
88
|
+
- spec/template_spec.rb
|
79
89
|
homepage: https://github.com/the-refinery/sparkpost_rails
|
80
90
|
licenses:
|
81
91
|
- MIT
|
@@ -101,10 +111,20 @@ signing_key:
|
|
101
111
|
specification_version: 4
|
102
112
|
summary: SparkPost for Rails
|
103
113
|
test_files:
|
104
|
-
- spec/
|
105
|
-
- spec/
|
106
|
-
- spec/
|
107
|
-
- spec/
|
114
|
+
- spec/cc_recipients_spec.rb
|
115
|
+
- spec/inline_content_spec.rb
|
116
|
+
- spec/return_path_spec.rb
|
117
|
+
- spec/recipients_list_spec.rb
|
118
|
+
- spec/campaign_id_spec.rb
|
108
119
|
- spec/response_spec.rb
|
120
|
+
- spec/bcc_recipients_spec.rb
|
121
|
+
- spec/sandbox_mode_spec.rb
|
109
122
|
- spec/from_spec.rb
|
123
|
+
- spec/recipients_spec.rb
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/template_spec.rb
|
126
|
+
- spec/open_tracking_spec.rb
|
110
127
|
- spec/reply_to_spec.rb
|
128
|
+
- spec/attachments_spec.rb
|
129
|
+
- spec/click_tracking_spec.rb
|
130
|
+
- spec/substitution_data_spec.rb
|
data/spec/options_spec.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe SparkPostRails::DeliveryMethod do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@delivery_method = SparkPostRails::DeliveryMethod.new
|
7
|
-
end
|
8
|
-
|
9
|
-
context "Options" do
|
10
|
-
|
11
|
-
it "handles track_opens option" do
|
12
|
-
SparkPostRails.configure do |c|
|
13
|
-
c.track_opens = true
|
14
|
-
end
|
15
|
-
|
16
|
-
test_email = Mailer.test_email
|
17
|
-
@delivery_method.deliver!(test_email)
|
18
|
-
|
19
|
-
expect(@delivery_method.data[:options][:open_tracking]).to eq(true)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "handles track_clicks option" do
|
23
|
-
SparkPostRails.configure do |c|
|
24
|
-
c.track_clicks = true
|
25
|
-
end
|
26
|
-
|
27
|
-
test_email = Mailer.test_email
|
28
|
-
@delivery_method.deliver!(test_email)
|
29
|
-
|
30
|
-
expect(@delivery_method.data[:options][:click_tracking]).to eq(true)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "does not contain unset campaign_id" do
|
34
|
-
test_email = Mailer.test_email
|
35
|
-
@delivery_method.deliver!(test_email)
|
36
|
-
|
37
|
-
expect(@delivery_method.data.has_key?(:campaign_id)).to eq(false)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "contains supplied campaign_id" do
|
41
|
-
SparkPostRails.configure do |c|
|
42
|
-
c.campaign_id = "ABCD1234"
|
43
|
-
end
|
44
|
-
|
45
|
-
test_email = Mailer.test_email
|
46
|
-
@delivery_method.deliver!(test_email)
|
47
|
-
|
48
|
-
expect(@delivery_method.data[:campaign_id]).to eq("ABCD1234")
|
49
|
-
end
|
50
|
-
|
51
|
-
it "does not contain unset return_path" do
|
52
|
-
test_email = Mailer.test_email
|
53
|
-
@delivery_method.deliver!(test_email)
|
54
|
-
|
55
|
-
expect(@delivery_method.data.has_key?(:return_path)).to eq(false)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "contains supplied return_path" do
|
59
|
-
SparkPostRails.configure do |c|
|
60
|
-
c.return_path = "BOUNCE-EMAIL@EXAMPLE.COM"
|
61
|
-
end
|
62
|
-
|
63
|
-
test_email = Mailer.test_email
|
64
|
-
@delivery_method.deliver!(test_email)
|
65
|
-
|
66
|
-
expect(@delivery_method.data[:return_path]).to eq('BOUNCE-EMAIL@EXAMPLE.COM')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|