messagebus-sdk 5.0.1 → 5.0.2
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.
@@ -23,7 +23,7 @@ class MessagebusActionMailerClient < MessagebusApiClient
|
|
23
23
|
|
24
24
|
def deliver!(message)
|
25
25
|
#minimum required headers
|
26
|
-
if message.to.first.nil? ||message.subject.nil? || message.from.first.nil? then
|
26
|
+
if message.to.first.nil? ||message.subject.nil? || message.from.first.nil? || message.return_path.nil? then
|
27
27
|
raise "Messagebus API error=Missing required header: :toEmail => #{message.to.first} :subject => #{message.subject} :fromEmail => #{message.from.first}"
|
28
28
|
end
|
29
29
|
|
@@ -41,7 +41,6 @@ class MessagebusActionMailerClient < MessagebusApiClient
|
|
41
41
|
|
42
42
|
custom_headers = {}
|
43
43
|
|
44
|
-
custom_headers["envelope-sender"] = message.return_path if !message.return_path.nil?
|
45
44
|
custom_headers["bcc"] = message.bcc[0] if !message.bcc.nil?
|
46
45
|
|
47
46
|
session_key = DEFAULT
|
@@ -61,6 +60,7 @@ class MessagebusActionMailerClient < MessagebusApiClient
|
|
61
60
|
:subject => message.subject,
|
62
61
|
:fromEmail => from_email,
|
63
62
|
:fromName => from_name,
|
63
|
+
:returnPath => message.return_path,
|
64
64
|
:sessionKey => session_key,
|
65
65
|
:customHeaders => custom_headers
|
66
66
|
}
|
@@ -26,7 +26,7 @@ describe MessagebusActionMailerClient do
|
|
26
26
|
message_params["toName"].should == ""
|
27
27
|
message_params["toEmail"].should == to_email
|
28
28
|
message_params["sessionKey"].should == "DEFAULT"
|
29
|
-
message_params["
|
29
|
+
message_params["returnPath"].should == "bounce@bounce.example.com"
|
30
30
|
end
|
31
31
|
|
32
32
|
it "works with from with nice name in address" do
|
@@ -61,7 +61,7 @@ describe MessagebusActionMailerClient do
|
|
61
61
|
message_params["toName"].should == ""
|
62
62
|
message_params["toEmail"].should == to_email
|
63
63
|
message_params["sessionKey"].should == "DEFAULT"
|
64
|
-
message_params["
|
64
|
+
message_params["returnPath"].should == "bounce@bounce.example.com"
|
65
65
|
message_params["customHeaders"]["bcc"].should == "goodbye@example.com"
|
66
66
|
message_params["customHeaders"]["x-header-a"].should == "header1"
|
67
67
|
message_params["customHeaders"]["x-tracking"].should == "1234"
|
@@ -93,7 +93,7 @@ describe MessagebusTemplateClient do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
it "#send_messages with batch size 25" do
|
96
|
-
FakeWeb.register_uri(:post, "#{@api_endpoint}/v5/templates/
|
96
|
+
FakeWeb.register_uri(:post, "#{@api_endpoint}/v5/templates/send", :body => json_templates_email_send)
|
97
97
|
|
98
98
|
template_messages = []
|
99
99
|
(1..25).each do |i|
|
@@ -105,7 +105,7 @@ describe MessagebusTemplateClient do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it "#send_messages with batch size 0" do
|
108
|
-
FakeWeb.register_uri(:post, "#{@api_endpoint}/v5/templates/
|
108
|
+
FakeWeb.register_uri(:post, "#{@api_endpoint}/v5/templates/send", :body => json_templates_email_send_empty)
|
109
109
|
|
110
110
|
template_messages = []
|
111
111
|
result = @client.send_messages(@template_key, template_messages)
|