sendgrid 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "json"
4
+
5
+ # Add dependencies required to use your gem here.
6
+ # Example:
7
+ # gem "activesupport", ">= 2.3.5"
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ # gem "shoulda", ">= 0"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.5.1"
15
+ # gem "rcov", ">= 0"
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ json (1.5.1)
10
+ rake (0.8.7)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.0.0)
17
+ jeweler (~> 1.5.1)
18
+ json
data/README.textile CHANGED
@@ -2,6 +2,8 @@ h1. sendgrid
2
2
 
3
3
  h3. What is SendGrid?
4
4
 
5
+ * NOTE: Now updated to work with Rails 3! *
6
+
5
7
  SendGrid is an awesome way to send large amounts of email (bells and whistles included) without spending large amounts of money. This gem allows for painless integration between ActionMailer and the SendGrid SMTP API. The current scope of this gem is focused around setting configuration options for outgoing email (essentially, setting categories, filters and the settings that can accompany those filters). SendGrid's service allows for some other cool stuff (such as postback notification of unsubscribes, bounces, etc.), but you'll have to integrate those features on your own.
6
8
 
7
9
  Visit "SendGrid":http://sendgrid.com to learn more.
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_dependency "json"
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.4
1
+ 0.2.0
data/lib/sendgrid.rb CHANGED
@@ -21,6 +21,14 @@ module SendGrid
21
21
  end
22
22
  attr_accessor :sg_category, :sg_options, :sg_disabled_options, :sg_recipients, :sg_substitutions, :subscriptiontrack_text, :footer_text, :spamcheck_score
23
23
  end
24
+
25
+ # NOTE: This commented-out approach may be a "safer" option for Rails 3, but it
26
+ # would cause the headers to get set during delivery, and not when the message is initialized.
27
+ # If base supports register_interceptor (i.e., Rails 3 ActionMailer), use it...
28
+ # if base.respond_to?(:register_interceptor)
29
+ # base.register_interceptor(SendgridInterceptor)
30
+ # end
31
+
24
32
  base.extend(ClassMethods)
25
33
  end
26
34
 
@@ -121,6 +129,7 @@ module SendGrid
121
129
  end
122
130
 
123
131
  # Sets the custom X-SMTPAPI header after creating the email but before delivery
132
+ # NOTE: This override is used for Rails 2 ActionMailer classes.
124
133
  def create!(method_name, *parameters)
125
134
  super
126
135
  if @sg_substitutions && !@sg_substitutions.empty?
@@ -131,6 +140,21 @@ module SendGrid
131
140
  puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(mail)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
132
141
  @mail['X-SMTPAPI'] = sendgrid_json_headers(mail)
133
142
  end
143
+
144
+ protected
145
+
146
+ # Sets the custom X-SMTPAPI header after creating the email but before delivery
147
+ # NOTE: This override is used for Rails 3 ActionMailer classes.
148
+ def mail(headers={}, &block)
149
+ super
150
+ if @sg_substitutions && !@sg_substitutions.empty?
151
+ @sg_substitutions.each do |find, replace|
152
+ raise ArgumentError.new("Array for #{find} is not the same size as the recipient array") if replace.size != @sg_recipients.size
153
+ end
154
+ end
155
+ puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(message)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
156
+ self.headers['X-SMTPAPI'] = sendgrid_json_headers(message)
157
+ end
134
158
 
135
159
  private
136
160
 
data/sendgrid.gemspec ADDED
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{sendgrid}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Stephen Blankenship"]
12
+ s.date = %q{2011-05-05}
13
+ s.description = %q{This gem allows simple integration between ActionMailer and SendGrid.
14
+ SendGrid is an email deliverability API that is affordable and has lots of bells and whistles.}
15
+ s.email = %q{stephenrb@gmail.com}
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.textile"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE",
25
+ "README.textile",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/sendgrid.rb",
29
+ "sendgrid.gemspec",
30
+ "test/sendgrid_test.rb",
31
+ "test/test_helper.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/stephenb/sendgrid}
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.5.3}
36
+ s.summary = %q{A gem that allows simple integration of ActionMailer with SendGrid (http://sendgrid.com)}
37
+ s.test_files = [
38
+ "test/sendgrid_test.rb",
39
+ "test/test_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<json>, [">= 0"])
47
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
49
+ s.add_runtime_dependency(%q<json>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<json>, [">= 0"])
52
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
54
+ s.add_dependency(%q<json>, [">= 0"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<json>, [">= 0"])
58
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
59
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
60
+ s.add_dependency(%q<json>, [">= 0"])
61
+ end
62
+ end
63
+
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
4
+ prerelease:
5
+ version: 0.2.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Stephen Blankenship
@@ -14,10 +10,53 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-04-16 00:00:00 -06:00
13
+ date: 2011-05-05 00:00:00 -05:00
18
14
  default_executable:
19
- dependencies: []
20
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: json
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: jeweler
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.1
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: json
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: *id004
21
60
  description: |-
22
61
  This gem allows simple integration between ActionMailer and SendGrid.
23
62
  SendGrid is an email deliverability API that is affordable and has lots of bells and whistles.
@@ -31,12 +70,14 @@ extra_rdoc_files:
31
70
  - README.textile
32
71
  files:
33
72
  - .document
34
- - .gitignore
73
+ - Gemfile
74
+ - Gemfile.lock
35
75
  - LICENSE
36
76
  - README.textile
37
77
  - Rakefile
38
78
  - VERSION
39
79
  - lib/sendgrid.rb
80
+ - sendgrid.gemspec
40
81
  - test/sendgrid_test.rb
41
82
  - test/test_helper.rb
42
83
  has_rdoc: true
@@ -44,32 +85,29 @@ homepage: http://github.com/stephenb/sendgrid
44
85
  licenses: []
45
86
 
46
87
  post_install_message:
47
- rdoc_options:
48
- - --charset=UTF-8
88
+ rdoc_options: []
89
+
49
90
  require_paths:
50
91
  - lib
51
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
52
94
  requirements:
53
95
  - - ">="
54
96
  - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
97
  version: "0"
58
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
59
100
  requirements:
60
101
  - - ">="
61
102
  - !ruby/object:Gem::Version
62
- segments:
63
- - 0
64
103
  version: "0"
65
104
  requirements: []
66
105
 
67
106
  rubyforge_project:
68
- rubygems_version: 1.3.6
107
+ rubygems_version: 1.5.3
69
108
  signing_key:
70
109
  specification_version: 3
71
110
  summary: A gem that allows simple integration of ActionMailer with SendGrid (http://sendgrid.com)
72
111
  test_files:
73
112
  - test/sendgrid_test.rb
74
113
  - test/test_helper.rb
75
- - test/test_mailers/kitchen_sink_mailer.rb
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
@@ -1,11 +0,0 @@
1
- class KitchenSinkMailer < ActionMailer::Base
2
- include SendGrid
3
-
4
- sendgrid_category :use_subject_lines
5
-
6
- def test_email
7
- recipients "dummy@dummy.com"
8
- from "web@dummy.com"
9
- subject "Test Email"
10
- end
11
- end