sparkpost_rails_eu 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +230 -0
- data/lib/sparkpost_rails.rb +64 -0
- data/lib/sparkpost_rails/data_options.rb +25 -0
- data/lib/sparkpost_rails/delivery_method.rb +402 -0
- data/lib/sparkpost_rails/exceptions.rb +17 -0
- data/lib/sparkpost_rails/railtie.rb +15 -0
- data/lib/sparkpost_rails/version.rb +4 -0
- data/spec/attachments_spec.rb +56 -0
- data/spec/bcc_recipients_spec.rb +102 -0
- data/spec/campaign_id_spec.rb +64 -0
- data/spec/cc_recipients_spec.rb +119 -0
- data/spec/click_tracking_spec.rb +54 -0
- data/spec/configuration_spec.rb +12 -0
- data/spec/delivery_schedule_spec.rb +46 -0
- data/spec/description_spec.rb +39 -0
- data/spec/exceptions_spec.rb +65 -0
- data/spec/from_spec.rb +24 -0
- data/spec/headers_spec.rb +33 -0
- data/spec/inline_content_spec.rb +63 -0
- data/spec/inline_css_spec.rb +49 -0
- data/spec/ip_pool_spec.rb +50 -0
- data/spec/metadata_spec.rb +44 -0
- data/spec/open_tracking_spec.rb +54 -0
- data/spec/recipient_specific_data_spec.rb +30 -0
- data/spec/recipients_list_spec.rb +34 -0
- data/spec/recipients_spec.rb +62 -0
- data/spec/reply_to_spec.rb +25 -0
- data/spec/response_spec.rb +26 -0
- data/spec/return_path_spec.rb +50 -0
- data/spec/sandbox_mode_spec.rb +53 -0
- data/spec/skip_suppression_spec.rb +27 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/subaccount_api_spec.rb +75 -0
- data/spec/substitution_data_spec.rb +40 -0
- data/spec/template_spec.rb +36 -0
- data/spec/transactional_spec.rb +50 -0
- metadata +161 -0
@@ -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
|
@@ -0,0 +1,50 @@
|
|
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 "Transactional" do
|
11
|
+
it "handles transactional flag set in the configuration" do
|
12
|
+
SparkPostRails.configure do |c|
|
13
|
+
c.transactional = true
|
14
|
+
end
|
15
|
+
|
16
|
+
test_email = Mailer.test_email
|
17
|
+
@delivery_method.deliver!(test_email)
|
18
|
+
|
19
|
+
expect(@delivery_method.data[:options][:transactional]).to eq(true)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "handles transactional set on an individual message" do
|
23
|
+
test_email = Mailer.test_email sparkpost_data: {transactional: true}
|
24
|
+
|
25
|
+
@delivery_method.deliver!(test_email)
|
26
|
+
|
27
|
+
expect(@delivery_method.data[:options][:transactional]).to eq(true)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "handles the value on an individual message overriding configuration" do
|
31
|
+
SparkPostRails.configure do |c|
|
32
|
+
c.transactional = true
|
33
|
+
end
|
34
|
+
|
35
|
+
test_email = Mailer.test_email sparkpost_data: {transactional: false}
|
36
|
+
|
37
|
+
@delivery_method.deliver!(test_email)
|
38
|
+
|
39
|
+
expect(@delivery_method.data[:options][:transactional]).to eq(false)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "handles unset value" do
|
43
|
+
test_email = Mailer.test_email
|
44
|
+
@delivery_method.deliver!(test_email)
|
45
|
+
|
46
|
+
expect(@delivery_method.data[:options][:transactional]).to eq(false)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sparkpost_rails_eu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Kimball
|
8
|
+
- Dave Goerlich
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2019-01-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.0'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '5.3'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '4.0'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.3'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rspec
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.4.0
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.4.0
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: webmock
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.24.2
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.24.2
|
62
|
+
description: Delivery Method for Rails ActionMailer to send emails using the SparkPost
|
63
|
+
API
|
64
|
+
email:
|
65
|
+
- kwkimball@gmail.com
|
66
|
+
- dave.goerlich@the-refinery.io
|
67
|
+
executables: []
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- lib/sparkpost_rails.rb
|
74
|
+
- lib/sparkpost_rails/data_options.rb
|
75
|
+
- lib/sparkpost_rails/delivery_method.rb
|
76
|
+
- lib/sparkpost_rails/exceptions.rb
|
77
|
+
- lib/sparkpost_rails/railtie.rb
|
78
|
+
- lib/sparkpost_rails/version.rb
|
79
|
+
- spec/attachments_spec.rb
|
80
|
+
- spec/bcc_recipients_spec.rb
|
81
|
+
- spec/campaign_id_spec.rb
|
82
|
+
- spec/cc_recipients_spec.rb
|
83
|
+
- spec/click_tracking_spec.rb
|
84
|
+
- spec/configuration_spec.rb
|
85
|
+
- spec/delivery_schedule_spec.rb
|
86
|
+
- spec/description_spec.rb
|
87
|
+
- spec/exceptions_spec.rb
|
88
|
+
- spec/from_spec.rb
|
89
|
+
- spec/headers_spec.rb
|
90
|
+
- spec/inline_content_spec.rb
|
91
|
+
- spec/inline_css_spec.rb
|
92
|
+
- spec/ip_pool_spec.rb
|
93
|
+
- spec/metadata_spec.rb
|
94
|
+
- spec/open_tracking_spec.rb
|
95
|
+
- spec/recipient_specific_data_spec.rb
|
96
|
+
- spec/recipients_list_spec.rb
|
97
|
+
- spec/recipients_spec.rb
|
98
|
+
- spec/reply_to_spec.rb
|
99
|
+
- spec/response_spec.rb
|
100
|
+
- spec/return_path_spec.rb
|
101
|
+
- spec/sandbox_mode_spec.rb
|
102
|
+
- spec/skip_suppression_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/subaccount_api_spec.rb
|
105
|
+
- spec/substitution_data_spec.rb
|
106
|
+
- spec/template_spec.rb
|
107
|
+
- spec/transactional_spec.rb
|
108
|
+
homepage: https://github.com/PatrickLef/sparkpost_rails
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.7.7
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: SparkPost for Rails with eu endpoint
|
132
|
+
test_files:
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
- spec/bcc_recipients_spec.rb
|
135
|
+
- spec/metadata_spec.rb
|
136
|
+
- spec/substitution_data_spec.rb
|
137
|
+
- spec/open_tracking_spec.rb
|
138
|
+
- spec/exceptions_spec.rb
|
139
|
+
- spec/recipients_list_spec.rb
|
140
|
+
- spec/campaign_id_spec.rb
|
141
|
+
- spec/inline_content_spec.rb
|
142
|
+
- spec/configuration_spec.rb
|
143
|
+
- spec/return_path_spec.rb
|
144
|
+
- spec/reply_to_spec.rb
|
145
|
+
- spec/headers_spec.rb
|
146
|
+
- spec/inline_css_spec.rb
|
147
|
+
- spec/recipients_spec.rb
|
148
|
+
- spec/response_spec.rb
|
149
|
+
- spec/template_spec.rb
|
150
|
+
- spec/click_tracking_spec.rb
|
151
|
+
- spec/ip_pool_spec.rb
|
152
|
+
- spec/delivery_schedule_spec.rb
|
153
|
+
- spec/cc_recipients_spec.rb
|
154
|
+
- spec/transactional_spec.rb
|
155
|
+
- spec/skip_suppression_spec.rb
|
156
|
+
- spec/attachments_spec.rb
|
157
|
+
- spec/recipient_specific_data_spec.rb
|
158
|
+
- spec/from_spec.rb
|
159
|
+
- spec/description_spec.rb
|
160
|
+
- spec/sandbox_mode_spec.rb
|
161
|
+
- spec/subaccount_api_spec.rb
|