sendgrid 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +2 -2
  2. data/VERSION +1 -1
  3. data/lib/sendgrid.rb +13 -12
  4. data/sendgrid.gemspec +4 -4
  5. metadata +8 -21
data/README.md CHANGED
@@ -56,14 +56,14 @@ Here is an example of what typical usage may look like:
56
56
  class MyMailer < ActionMailer::Base
57
57
  include SendGrid
58
58
  sendgrid_category :use_subject_lines
59
- sendgrid_enable :ganalytics, :opentracking
59
+ sendgrid_enable :ganalytics, :opentrack
60
60
 
61
61
  def welcome_message(user)
62
62
  sendgrid_category "Welcome"
63
63
  mail :to => user.email, :subject => "Welcome #{user.name} :-)"
64
64
  end
65
65
 
66
- def goodbye_message(to_user)
66
+ def goodbye_message(user)
67
67
  sendgrid_disable :ganalytics
68
68
  mail :to => user.email, :subject => "Fare thee well :-("
69
69
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -133,38 +133,39 @@ module SendGrid
133
133
  @sg_unique_args = args
134
134
  end
135
135
 
136
- # only override the appropriet methods for the current rails version
137
- if Rails.version < '3.0.0'
136
+ # only override the appropriate methods for the current ActionMailer version
137
+ if ActionMailer::Base.respond_to?(:mail)
138
+
139
+ protected
138
140
 
139
141
  # Sets the custom X-SMTPAPI header after creating the email but before delivery
140
- # NOTE: This override is used for Rails 2 ActionMailer classes.
141
- def create!(method_name, *parameters)
142
+ # NOTE: This override is used for Rails 3 ActionMailer classes.
143
+ def mail(headers={}, &block)
142
144
  super
143
145
  if @sg_substitutions && !@sg_substitutions.empty?
144
146
  @sg_substitutions.each do |find, replace|
145
147
  raise ArgumentError.new("Array for #{find} is not the same size as the recipient array") if replace.size != @sg_recipients.size
146
148
  end
147
149
  end
148
- puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(mail)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
149
- @mail['X-SMTPAPI'] = sendgrid_json_headers(mail)
150
+ puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(message)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
151
+ self.headers['X-SMTPAPI'] = sendgrid_json_headers(message)
150
152
  end
151
153
 
152
154
  else
153
155
 
154
- protected
155
-
156
156
  # Sets the custom X-SMTPAPI header after creating the email but before delivery
157
- # NOTE: This override is used for Rails 3 ActionMailer classes.
158
- def mail(headers={}, &block)
157
+ # NOTE: This override is used for Rails 2 ActionMailer classes.
158
+ def create!(method_name, *parameters)
159
159
  super
160
160
  if @sg_substitutions && !@sg_substitutions.empty?
161
161
  @sg_substitutions.each do |find, replace|
162
162
  raise ArgumentError.new("Array for #{find} is not the same size as the recipient array") if replace.size != @sg_recipients.size
163
163
  end
164
164
  end
165
- puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(message)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
166
- self.headers['X-SMTPAPI'] = sendgrid_json_headers(message)
165
+ puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(mail)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
166
+ @mail['X-SMTPAPI'] = sendgrid_json_headers(mail)
167
167
  end
168
+
168
169
  end
169
170
 
170
171
  private
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sendgrid}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Stephen Blankenship"]
12
- s.date = %q{2011-06-09}
12
+ s.date = %q{2011-09-08}
13
13
  s.description = %q{This gem allows simple integration between ActionMailer and SendGrid.
14
14
  SendGrid is an email deliverability API that is affordable and has lots of bells and whistles.}
15
15
  s.email = %q{stephenrb@gmail.com}
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  ]
33
33
  s.homepage = %q{http://github.com/stephenb/sendgrid}
34
34
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.7}
35
+ s.rubygems_version = %q{1.3.6}
36
36
  s.summary = %q{A gem that allows simple integration of ActionMailer with SendGrid (http://sendgrid.com)}
37
37
  s.test_files = [
38
38
  "test/sendgrid_test.rb",
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
44
  s.specification_version = 3
45
45
 
46
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
47
  s.add_runtime_dependency(%q<json>, [">= 0"])
48
48
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
49
49
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
- - 0
10
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Stephen Blankenship
@@ -15,69 +14,61 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-06-09 00:00:00 -05:00
17
+ date: 2011-09-08 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
21
  type: :runtime
24
22
  name: json
25
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ">="
29
26
  - !ruby/object:Gem::Version
30
- hash: 3
31
27
  segments:
32
28
  - 0
33
29
  version: "0"
34
30
  requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
31
  prerelease: false
32
+ - !ruby/object:Gem::Dependency
37
33
  type: :development
38
34
  name: bundler
39
35
  version_requirements: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
36
  requirements:
42
37
  - - ~>
43
38
  - !ruby/object:Gem::Version
44
- hash: 23
45
39
  segments:
46
40
  - 1
47
41
  - 0
48
42
  - 0
49
43
  version: 1.0.0
50
44
  requirement: *id002
51
- - !ruby/object:Gem::Dependency
52
45
  prerelease: false
46
+ - !ruby/object:Gem::Dependency
53
47
  type: :development
54
48
  name: jeweler
55
49
  version_requirements: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
50
  requirements:
58
51
  - - ~>
59
52
  - !ruby/object:Gem::Version
60
- hash: 1
61
53
  segments:
62
54
  - 1
63
55
  - 5
64
56
  - 1
65
57
  version: 1.5.1
66
58
  requirement: *id003
67
- - !ruby/object:Gem::Dependency
68
59
  prerelease: false
60
+ - !ruby/object:Gem::Dependency
69
61
  type: :runtime
70
62
  name: json
71
63
  version_requirements: &id004 !ruby/object:Gem::Requirement
72
- none: false
73
64
  requirements:
74
65
  - - ">="
75
66
  - !ruby/object:Gem::Version
76
- hash: 3
77
67
  segments:
78
68
  - 0
79
69
  version: "0"
80
70
  requirement: *id004
71
+ prerelease: false
81
72
  description: |-
82
73
  This gem allows simple integration between ActionMailer and SendGrid.
83
74
  SendGrid is an email deliverability API that is affordable and has lots of bells and whistles.
@@ -111,27 +102,23 @@ rdoc_options: []
111
102
  require_paths:
112
103
  - lib
113
104
  required_ruby_version: !ruby/object:Gem::Requirement
114
- none: false
115
105
  requirements:
116
106
  - - ">="
117
107
  - !ruby/object:Gem::Version
118
- hash: 3
119
108
  segments:
120
109
  - 0
121
110
  version: "0"
122
111
  required_rubygems_version: !ruby/object:Gem::Requirement
123
- none: false
124
112
  requirements:
125
113
  - - ">="
126
114
  - !ruby/object:Gem::Version
127
- hash: 3
128
115
  segments:
129
116
  - 0
130
117
  version: "0"
131
118
  requirements: []
132
119
 
133
120
  rubyforge_project:
134
- rubygems_version: 1.3.7
121
+ rubygems_version: 1.3.6
135
122
  signing_key:
136
123
  specification_version: 3
137
124
  summary: A gem that allows simple integration of ActionMailer with SendGrid (http://sendgrid.com)