postmark-rails 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = Changelog
2
2
 
3
+ == 0.5.2
4
+
5
+ * Removed the legacy code providing Rails 2 support.
6
+ * Added a Railtie for proper initialization in Rails 3+.
7
+ * Removed the post-install message.
8
+
3
9
  == 0.5.1
4
10
 
5
11
  * Upgraded actionmailer dependency to use >= 3.0.0.
data/README.md CHANGED
@@ -16,7 +16,7 @@ For Rails 2.3 please take a look at [version 0.4](https://github.com/wildbit/pos
16
16
  Add this to your Gemfile: (change version numbers if needed)
17
17
 
18
18
  ``` ruby
19
- gem 'postmark-rails', '~> 0.5.1'
19
+ gem 'postmark-rails', '~> 0.5.2'
20
20
  ```
21
21
 
22
22
  Don’t forget to run `bundle install` command every time you change something in the Gemfile.
@@ -28,6 +28,8 @@ config.action_mailer.delivery_method = :postmark
28
28
  config.action_mailer.postmark_settings = { :api_key => "your-api-key" }
29
29
  ```
30
30
 
31
+ The `postmark_settings` hash can contain [all options](https://github.com/wildbit/postmark-gem#communicating-with-the-api) supported by `Postmark::ApiClient`.
32
+
31
33
  For the API details, refer to the [developer documentation](http://developer.postmarkapp.com).
32
34
 
33
35
  ## Tagging your deliveries
@@ -1,26 +1,16 @@
1
1
  require 'action_mailer'
2
2
  require 'postmark'
3
- require 'postmark_delivery_method'
4
3
 
5
- module PostmarkInstaller
4
+ module PostmarkRails
6
5
  extend self
7
6
 
8
- def auto_detect_and_install
9
- if ActionMailer::Base.respond_to?(:add_delivery_method)
10
- install_in_rails
11
- else
12
- install_in_legacy_rails
13
- end
14
- end
15
-
16
- def install_in_legacy_rails
17
- ActionMailer::Base.send(:include, PostmarkDeliveryMethod)
18
- end
19
-
20
- def install_in_rails
7
+ def install
21
8
  ActionMailer::Base.add_delivery_method :postmark, Mail::Postmark, :api_key => nil
22
9
  end
23
-
24
10
  end
25
11
 
26
- PostmarkInstaller.auto_detect_and_install
12
+ if defined?(Rails)
13
+ require 'postmark-rails/railtie'
14
+ else
15
+ PostmarkRails.install
16
+ end
@@ -0,0 +1,9 @@
1
+ module PostmarkRails
2
+ class Railtie < Rails::Railtie
3
+ initializer 'postmark-rails', :before => 'action_mailer.set_configs' do
4
+ ActiveSupport.on_load :action_mailer do
5
+ PostmarkRails.install
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,3 @@
1
- module Postmark
2
- module Rails
3
- VERSION = '0.5.1'
4
- end
1
+ module PostmarkRails
2
+ VERSION = '0.5.2'
5
3
  end
@@ -3,20 +3,13 @@ require "postmark-rails/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{postmark-rails}
6
- s.version = Postmark::Rails::VERSION
6
+ s.version = PostmarkRails::VERSION
7
7
  s.authors = ["Petyo Ivanov", "Ilya Sabanin", "Artem Chistyakov"]
8
- s.description = %q{Use this plugin in your rails applications to send emails through the Postmark API}
9
- s.email = %q{ilya@wildbit.com}
8
+ s.description = %q{The Postmark Rails Gem is a drop-in plug-in for ActionMailer to send emails via Postmark, an email delivery service for web apps.}
9
+ s.email = %q{tema@wildbit.com}
10
10
  s.homepage = %q{http://postmarkapp.com}
11
11
  s.summary = %q{Postmark adapter for ActionMailer}
12
12
 
13
- s.post_install_message = %q{
14
- ==================
15
- Thanks for installing the postmark-rails gem. If you don't have an account, please sign up at http://postmarkapp.com/.
16
- Review the README.md for implementation details and examples.
17
- ==================
18
- }
19
-
20
13
  s.extra_rdoc_files = [
21
14
  "LICENSE",
22
15
  "README.md"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmark-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-07-02 00:00:00.000000000 Z
14
+ date: 2013-08-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: actionmailer
@@ -61,9 +61,9 @@ dependencies:
61
61
  - - ! '>='
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
- description: Use this plugin in your rails applications to send emails through the
65
- Postmark API
66
- email: ilya@wildbit.com
64
+ description: The Postmark Rails Gem is a drop-in plug-in for ActionMailer to send
65
+ emails via Postmark, an email delivery service for web apps.
66
+ email: tema@wildbit.com
67
67
  executables: []
68
68
  extensions: []
69
69
  extra_rdoc_files:
@@ -82,8 +82,8 @@ files:
82
82
  - gemfiles/Gemfile.actionmailer-3.2.x
83
83
  - gemfiles/Gemfile.actionmailer-4.0.x
84
84
  - lib/postmark-rails.rb
85
+ - lib/postmark-rails/railtie.rb
85
86
  - lib/postmark-rails/version.rb
86
- - lib/postmark_delivery_method.rb
87
87
  - postmark-rails.gemspec
88
88
  - spec/fixtures/empty.gif
89
89
  - spec/fixtures/models/test_mailer.rb
@@ -99,10 +99,7 @@ files:
99
99
  - spec/spec_helper.rb
100
100
  homepage: http://postmarkapp.com
101
101
  licenses: []
102
- post_install_message: ! "\n ==================\n Thanks for installing the postmark-rails
103
- gem. If you don't have an account, please sign up at http://postmarkapp.com/.\n
104
- \ Review the README.md for implementation details and examples.\n ==================\n
105
- \ "
102
+ post_install_message:
106
103
  rdoc_options:
107
104
  - --charset=UTF-8
108
105
  require_paths:
@@ -115,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
112
  version: '0'
116
113
  segments:
117
114
  - 0
118
- hash: 4431092584679978138
115
+ hash: -233534591374773788
119
116
  required_rubygems_version: !ruby/object:Gem::Requirement
120
117
  none: false
121
118
  requirements:
@@ -124,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
121
  version: '0'
125
122
  segments:
126
123
  - 0
127
- hash: 4431092584679978138
124
+ hash: -233534591374773788
128
125
  requirements: []
129
126
  rubyforge_project:
130
127
  rubygems_version: 1.8.25
@@ -1,41 +0,0 @@
1
- #
2
- # This module is only used for Rails 2.
3
- #
4
- module PostmarkDeliveryMethod
5
-
6
- module ClassMethods
7
-
8
- def postmark_api_key=(value)
9
- Postmark.api_key = value
10
- end
11
-
12
- end
13
-
14
- def self.included(base)
15
- base.extend(ClassMethods)
16
-
17
- base.class_eval do
18
- alias_method_chain :create_mail, :postmark_extras
19
- end
20
- end
21
-
22
- def perform_delivery_postmark(message)
23
- Postmark.send_through_postmark(message)
24
- end
25
-
26
- def tag(value)
27
- @tag = value
28
- end
29
-
30
- def postmark_attachments(value)
31
- @attachments = value
32
- end
33
-
34
- def create_mail_with_postmark_extras
35
- create_mail_without_postmark_extras.tap do |mail|
36
- mail.tag = @tag if @tag
37
- mail.postmark_attachments = @attachments if @attachments
38
- end
39
- end
40
-
41
- end