sendgrid 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sendgrid.rb +8 -8
- data/test/sendgrid_test.rb +3 -23
- data/test/test_helper.rb +0 -3
- metadata +4 -13
data/README.textile
CHANGED
@@ -114,7 +114,7 @@ One issue that arises when delivering multiple emails at once is custom content.
|
|
114
114
|
sendgrid_substitue "<subme>", ["sub text for 1st recipient", "sub text for 2nd recipient", "sub text for 3rd recipient", ...]
|
115
115
|
</pre>
|
116
116
|
|
117
|
-
In this example, if
|
117
|
+
In this example, if <code><subme></code> is in the body of your email SendGrid will automatically substitute it for the string corresponding the recipient being delivered to. NOTE: You should ensure that the length of the substitution array is equal to the length of the recipients array.
|
118
118
|
|
119
119
|
h3. TODO
|
120
120
|
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.email = "stephenrb@gmail.com"
|
12
12
|
gem.homepage = "http://github.com/stephenb/sendgrid"
|
13
13
|
gem.authors = ["Stephen Blankenship"]
|
14
|
-
gem.add_development_dependency "thoughtbot-shoulda"
|
14
|
+
# gem.add_development_dependency "thoughtbot-shoulda"
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/sendgrid.rb
CHANGED
@@ -105,26 +105,26 @@ module SendGrid
|
|
105
105
|
def sendgrid_subscriptiontrack_text(texts)
|
106
106
|
@subscriptiontrack_text = texts
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
# Call within mailer method to override the default value.
|
110
110
|
def sendgrid_footer_text(texts)
|
111
111
|
@footer_text = texts
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
# Call within mailer method to override the default value.
|
115
115
|
def sendgrid_spamcheck_maxscore(score)
|
116
116
|
@spamcheck_score = score
|
117
117
|
end
|
118
|
-
|
119
|
-
private
|
120
118
|
|
121
|
-
# Sets the custom X-SMTPAPI header
|
122
|
-
def
|
123
|
-
puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(mail)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
|
124
|
-
mail['X-SMTPAPI'] = sendgrid_json_headers(mail)
|
119
|
+
# Sets the custom X-SMTPAPI header after creating the email but before delivery
|
120
|
+
def create!(method_name, *parameters)
|
125
121
|
super
|
122
|
+
puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(mail)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
|
123
|
+
@mail['X-SMTPAPI'] = sendgrid_json_headers(mail)
|
126
124
|
end
|
127
125
|
|
126
|
+
private
|
127
|
+
|
128
128
|
# Take all of the options and turn it into the json format that SendGrid expects
|
129
129
|
def sendgrid_json_headers(mail)
|
130
130
|
header_opts = {}
|
data/test/sendgrid_test.rb
CHANGED
@@ -1,27 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
4
|
-
|
5
|
-
|
6
|
-
email = KitchenSinkMailer.deliver_test_email
|
7
|
-
assert_equal "Test Email", email.subject
|
8
|
-
end
|
3
|
+
class SendgridTest < Test::Unit::TestCase
|
4
|
+
should "probably rename this file and start testing for real" do
|
5
|
+
flunk "hey buddy, you should probably rename this file and start testing for real"
|
9
6
|
end
|
10
7
|
end
|
11
|
-
|
12
|
-
# class UserMailerTest < ActionMailer::TestCase
|
13
|
-
# tests UserMailer
|
14
|
-
#
|
15
|
-
# def test_welcome_email
|
16
|
-
# user = users(:some_user_in_your_fixtures)
|
17
|
-
#
|
18
|
-
# # Send the email, then test that it got queued
|
19
|
-
# email = UserMailer.deliver_welcome_email(user)
|
20
|
-
# assert !ActionMailer::Base.deliveries.empty?
|
21
|
-
#
|
22
|
-
# # Test the body of the sent email contains what we expect it to
|
23
|
-
# assert_equal [@user.email], email.to
|
24
|
-
# assert_equal "Welcome to My Awesome Site", email.subject
|
25
|
-
# assert_match /Welcome to example.com, #{user.first_name}/, email.body
|
26
|
-
# end
|
27
|
-
# end
|
data/test/test_helper.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
3
|
require 'shoulda'
|
4
|
-
require 'actionmailer'
|
5
4
|
|
6
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
7
|
require 'sendgrid'
|
9
8
|
|
10
9
|
class Test::Unit::TestCase
|
11
|
-
ActionMailer::Base.delivery_method = :test
|
12
|
-
ActionMailer::Base.template_root = "/test/test_mailers"
|
13
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Blankenship
|
@@ -9,19 +9,10 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-02 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: thoughtbot-shoulda
|
17
|
-
type: :development
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
25
16
|
description: |-
|
26
17
|
This gem allows simple integration between ActionMailer and SendGrid.
|
27
18
|
SendGrid is an email deliverability API that is affordable and has lots of bells and whistles.
|