postmark-rails 0.1.0
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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +35 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/postmark-rails.rb +15 -0
- data/spec/fixtures/models/test_mailer.rb +15 -0
- data/spec/fixtures/views/test_mailer/multipart_message.text.html.erb +1 -0
- data/spec/fixtures/views/test_mailer/multipart_message.text.plain.erb +1 -0
- data/spec/fixtures/views/test_mailer/simple_message.erb +1 -0
- data/spec/postmark-rails_spec.rb +11 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +18 -0
- metadata +90 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Petyo Ivanov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
= Postmark rails gem
|
2
|
+
|
3
|
+
Postmark plug-in for ActionMailer
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
sudo gem install postmark-rails
|
8
|
+
|
9
|
+
== Example
|
10
|
+
|
11
|
+
#config/environment.rb
|
12
|
+
|
13
|
+
Rails::Initializer.run do |config|
|
14
|
+
config.gem 'postmark-rails'
|
15
|
+
config.action_mailer.delivery_method = :postmark
|
16
|
+
config.action_mailer.postmark_api_key = "your-api-key"
|
17
|
+
# ...
|
18
|
+
end
|
19
|
+
|
20
|
+
== Requirements
|
21
|
+
|
22
|
+
You will also need postmark account, server and sender signature set up to use it.
|
23
|
+
|
24
|
+
== Note on Patches/Pull Requests
|
25
|
+
|
26
|
+
* Fork the project.
|
27
|
+
* Make your feature addition or bug fix.
|
28
|
+
* Add tests for it. This is important so I don't break it in a
|
29
|
+
future version unintentionally.
|
30
|
+
* Commit, do not mess with rakefile, version, or history.
|
31
|
+
* Send me a pull request. Bonus points for topic branches.
|
32
|
+
|
33
|
+
== Copyright
|
34
|
+
|
35
|
+
Copyright (c) 2009 Wildbit LLC. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "postmark-rails"
|
8
|
+
gem.summary = %Q{Postmark adapter for ActionMailer}
|
9
|
+
gem.description = %Q{Use this plugin in your rails applications to send emails through the Postmark API}
|
10
|
+
gem.email = "underlog@gmail.com"
|
11
|
+
gem.homepage = "http://postmarkapp.com"
|
12
|
+
gem.authors = ["Petyo Ivanov"]
|
13
|
+
gem.add_development_dependency "rspec"
|
14
|
+
gem.add_dependency 'postmark'
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
+
spec.libs << 'lib' << 'spec'
|
25
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
end
|
27
|
+
|
28
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
spec.rcov = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :spec => :check_dependencies
|
35
|
+
|
36
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
if File.exist?('VERSION')
|
41
|
+
version = File.read('VERSION')
|
42
|
+
else
|
43
|
+
version = ""
|
44
|
+
end
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "postmark-rails #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'postmark'
|
2
|
+
|
3
|
+
module PostmarkMethods
|
4
|
+
def perform_delivery_postmark(message)
|
5
|
+
Postmark.send_through_postmark(message)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class ActionMailer::Base
|
10
|
+
include PostmarkMethods
|
11
|
+
|
12
|
+
def self.postmark_api_key=(value)
|
13
|
+
Postmark.api_key = value
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class TestMailer < ActionMailer::Base
|
2
|
+
|
3
|
+
def simple_message
|
4
|
+
subject 'hello'
|
5
|
+
recipients 'sheldon@bigbangtheory.com'
|
6
|
+
from 'leonard@bigbangtheory.com'
|
7
|
+
end
|
8
|
+
|
9
|
+
def multipart_message
|
10
|
+
subject 'hello'
|
11
|
+
recipients 'sheldon@bigbangtheory.com'
|
12
|
+
from 'leonard@bigbangtheory.com'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<b>hello</b>
|
@@ -0,0 +1 @@
|
|
1
|
+
hello
|
@@ -0,0 +1 @@
|
|
1
|
+
hello
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "PostmarkRails" do
|
4
|
+
it "should use postmark for delivery" do
|
5
|
+
Postmark.should_receive(:send_through_postmark) do |message|
|
6
|
+
message.subject.should == "hello"
|
7
|
+
end
|
8
|
+
TestMailer.deliver_simple_message
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ruby-debug'
|
5
|
+
require 'actionmailer'
|
6
|
+
require 'postmark-rails'
|
7
|
+
require 'spec'
|
8
|
+
require 'spec/autorun'
|
9
|
+
|
10
|
+
ActionMailer::Base.delivery_method = :postmark
|
11
|
+
ActionMailer::Base.template_root = File.join(File.dirname(__FILE__), "fixtures", "views")
|
12
|
+
|
13
|
+
# require models
|
14
|
+
Dir["#{File.dirname(__FILE__)}/fixtures/models/*.rb"].each { |f| require f }
|
15
|
+
|
16
|
+
Spec::Runner.configure do |config|
|
17
|
+
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: postmark-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Petyo Ivanov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-04 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
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:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: postmark
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: Use this plugin in your rails applications to send emails through the Postmark API
|
36
|
+
email: underlog@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- .document
|
46
|
+
- .gitignore
|
47
|
+
- LICENSE
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- VERSION
|
51
|
+
- lib/postmark-rails.rb
|
52
|
+
- spec/fixtures/models/test_mailer.rb
|
53
|
+
- spec/fixtures/views/test_mailer/multipart_message.text.html.erb
|
54
|
+
- spec/fixtures/views/test_mailer/multipart_message.text.plain.erb
|
55
|
+
- spec/fixtures/views/test_mailer/simple_message.erb
|
56
|
+
- spec/postmark-rails_spec.rb
|
57
|
+
- spec/spec.opts
|
58
|
+
- spec/spec_helper.rb
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: http://postmarkapp.com
|
61
|
+
licenses: []
|
62
|
+
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options:
|
65
|
+
- --charset=UTF-8
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
version:
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.3.4
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: Postmark adapter for ActionMailer
|
87
|
+
test_files:
|
88
|
+
- spec/fixtures/models/test_mailer.rb
|
89
|
+
- spec/postmark-rails_spec.rb
|
90
|
+
- spec/spec_helper.rb
|