http_mailer 0.0.4 → 0.0.5
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 +4 -4
- data/lib/http_mailer/mailgun/mailgun_service_api.rb +1 -1
- data/lib/http_mailer/version.rb +1 -1
- data/spec/client_spec.rb +2 -2
- data/spec/mailgun/mailgun_service_api_spec.rb +1 -1
- data/spec/mailgun/mailgun_service_handler_spec.rb +4 -4
- data/spec/spec_helper.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7543d7c4535c14bf3f0a728f48d4c11daa9953
|
4
|
+
data.tar.gz: 809069c15685e40d2df9dab51843caa3e1ff8051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33ab2b97224bc9d508ef4df60be77708f0c1954e76b9aec04b877792d725e76249140f4e367a021eda9d197d2d01886c6913248c7e49ae99bc9dcf118750036
|
7
|
+
data.tar.gz: 8331b0a4182bbfd24ba252d071088e98eb0f792eecb4d20338db32ff3a4b3cbaf5f1e16fca8653a34d07a9c161cf366b2290fe0a7ffa0ead8bf4e0e60fb30054
|
@@ -11,7 +11,7 @@ module HttpMailer
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def send_messages_url
|
14
|
-
"#{self.protocol}://api
|
14
|
+
"#{self.protocol}://api:#{self.api_key}@#{self.host}/#{self.version}/#{self.subdomain}/messages"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/http_mailer/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe HttpMailer::Client do
|
4
4
|
|
5
5
|
context "when configured" do
|
6
|
-
let(:settings){ {:mailgun => {:host => "api.mailgun.net", :api_key => "12345", :subdomain => "sandbox12345.mailgun.org"},
|
6
|
+
let(:settings){ {:mailgun => {:host => "api.mailgun.net", :api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"},
|
7
7
|
:sendgrid => {:host => "sendgrid.com", :api_user=> "test", :api_key => "1234"},
|
8
8
|
:mandrill => {:host => "mandrillapp.com", :api_key => "1234567890"}} }
|
9
9
|
|
@@ -14,7 +14,7 @@ describe HttpMailer::Client do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#send_message' do
|
17
|
-
let(:settings){ {:mailgun => {:host => "api.mailgun.net", :api_key => "12345", :subdomain => "sandbox12345.mailgun.org"},
|
17
|
+
let(:settings){ {:mailgun => {:host => "api.mailgun.net", :api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"},
|
18
18
|
:sendgrid => {:host => "sendgrid.com", :api_user=> "test", :api_key => "1234"},
|
19
19
|
:mandrill => {:host => "mandrillapp.com", :api_key => "1234567890"}} }
|
20
20
|
let(:mailer_client){ HttpMailer::Client.new(settings) }
|
@@ -4,7 +4,7 @@ describe HttpMailer::MailgunServiceApi do
|
|
4
4
|
|
5
5
|
describe "#send_messages_url" do
|
6
6
|
let(:host){ "api.mailgun.net" }
|
7
|
-
let(:api_key){ "1234567890" }
|
7
|
+
let(:api_key){ "key-1234567890" }
|
8
8
|
let(:subdomain){ "sandbox1234567890.mailgun.org" }
|
9
9
|
let(:protocol){ "https" }
|
10
10
|
let(:version){ "v2" }
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe HttpMailer::MailgunServiceHandler do
|
4
4
|
|
5
5
|
describe "#send_message" do
|
6
|
-
let(:settings){ {:host => "api.mailgun.net", :api_key => "12345", :subdomain => "sandbox12345.mailgun.org"} }
|
6
|
+
let(:settings){ {:host => "api.mailgun.net", :api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"} }
|
7
7
|
let(:mailer){ HttpMailer::MailgunServiceHandler.new(settings) }
|
8
8
|
let(:sender){ "Mailgun Sandbox <postmaster@sandbox12345.mailgun.org>"}
|
9
9
|
let(:reciever){ "Test <test@gmail.com>" }
|
@@ -18,7 +18,7 @@ describe HttpMailer::MailgunServiceHandler do
|
|
18
18
|
|
19
19
|
describe "#configured?" do
|
20
20
|
context "fully configured" do
|
21
|
-
let(:settings){ {:host => "api.mailgun.net", :api_key => "12345", :subdomain => "sandbox12345.mailgun.org"} }
|
21
|
+
let(:settings){ {:host => "api.mailgun.net", :api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"} }
|
22
22
|
let(:mailer){ HttpMailer::MailgunServiceHandler.new(settings) }
|
23
23
|
|
24
24
|
it 'returns true' do
|
@@ -30,13 +30,13 @@ describe HttpMailer::MailgunServiceHandler do
|
|
30
30
|
let(:no_settings){ {} }
|
31
31
|
let(:mailer_with_no_settings){ HttpMailer::MailgunServiceHandler.new(no_settings) }
|
32
32
|
|
33
|
-
let(:settings_missing_host){ {:api_key => "12345", :subdomain => "sandbox12345.mailgun.org"} }
|
33
|
+
let(:settings_missing_host){ {:api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"} }
|
34
34
|
let(:mailer_missing_host){ HttpMailer::MailgunServiceHandler.new(settings_missing_host) }
|
35
35
|
|
36
36
|
let(:settings_missing_api_key){ {:host => "api.mailgun.net", :subdomain => "sandbox12345.mailgun.org"} }
|
37
37
|
let(:mailer_missing_api_key){ HttpMailer::MailgunServiceHandler.new(settings_missing_api_key) }
|
38
38
|
|
39
|
-
let(:settings_missing_subdomain){ {:host => "api.mailgun.net", :api_key => "12345"} }
|
39
|
+
let(:settings_missing_subdomain){ {:host => "api.mailgun.net", :api_key => "key-12345"} }
|
40
40
|
let(:mailer_missing_subdomain){ HttpMailer::MailgunServiceHandler.new(settings_missing_subdomain) }
|
41
41
|
|
42
42
|
it 'returns false' do
|
data/spec/spec_helper.rb
CHANGED
@@ -12,17 +12,17 @@ RSpec.configure do |config|
|
|
12
12
|
:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'Content-Length'=>'224', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}).
|
13
13
|
to_return(:status => 200, :body => "", :headers => {})
|
14
14
|
|
15
|
-
stub_request(:post, "https://api:key-12345@api.mailgun.net/v2/sandbox12345.mailgun.org/messages").
|
16
|
-
with(:body => {"from"=>"sender@test.com", "subject"=>"Hello", "text"=>"Congratulations, you just sent an email with HttpMailer! You are truly awesome!", "to"=>"reciever@test.com>"},
|
17
|
-
:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'Content-Length'=>'174', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}).
|
18
|
-
to_return(:status => 200, :body => "", :headers => {})
|
19
|
-
|
20
15
|
# Stub SendGrid HTTP requests
|
21
16
|
stub_request(:post, "https://sendgrid.com/api/mail.send.json").
|
22
17
|
with(:body => {"api_key"=>/.*/, "api_user"=>/.*/, "from"=>/.*/, "fromname"=>/.*/, "subject"=>/.*/, "text"=>/.*/, "to"=>/.*/, "toname"=>/.*/},
|
23
18
|
:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'Content-Length'=>'208', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}).
|
24
19
|
to_return(:status => 200, :body => "", :headers => {})
|
25
20
|
|
21
|
+
stub_request(:post, "https://sendgrid.com/api/mail.send.json").
|
22
|
+
with(:body => {"api_key"=>"1234", "api_user"=>"test", "from"=>"sender@test.com", "fromname"=>"", "subject"=>"Hello", "text"=>"Congratulations, you just sent an email with HttpMailer! You are truly awesome!", "to"=>"reciever@test.com>", "toname"=>""},
|
23
|
+
:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'Content-Length'=>'219', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}).
|
24
|
+
to_return(:status => 200, :body => "", :headers => {})
|
25
|
+
|
26
26
|
# Stub Mandrill HTTP requests
|
27
27
|
stub_request(:post, "https://mandrillapp.com/api/1.0/messages/send.json").
|
28
28
|
with(:body => "{\"key\":\"1234567890\",\"message\":{\"html\":null,\"text\":\"Congratulations, you just sent an email with Mandrill! You are truly awesome!\",\"subject\":\"Hello\",\"from_email\":\"papa@prose.com\",\"from_name\":\"Ernest Hemingway\",\"to\":[{\"email\":\"jd@catcher.com\",\"name\":\"JD Salinger\"}],\"headers\":{},\"important\":null,\"track_opens\":null,\"track_clicks\":null,\"auto_text\":null,\"auto_html\":null,\"inline_css\":null,\"url_strip_qs\":null,\"preserve_recipients\":null,\"view_content_link\":null,\"bcc_address\":null,\"tracking_domain\":null,\"signing_domain\":null,\"return_path_domain\":null,\"merge\":null,\"merge_language\":null,\"global_merge_vars\":[],\"merge_vars\":[],\"tags\":[],\"subaccount\":null,\"google_analytics_domains\":[],\"google_analytics_campaign\":null,\"metadata\":[],\"recipient_metadata\":[],\"attachments\":[],\"images\":[]}}",
|