postmark-rails 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +5 -0
- data/README.md +21 -2
- data/gemfiles/Gemfile.actionmailer-3.0.x +1 -1
- data/gemfiles/Gemfile.actionmailer-3.2.x +1 -1
- data/gemfiles/Gemfile.actionmailer-4.0.x +1 -1
- data/gemfiles/Gemfile.actionmailer-4.1.x +1 -1
- data/gemfiles/Gemfile.actionmailer-4.2.x +1 -1
- data/lib/postmark-rails.rb +11 -2
- data/lib/postmark-rails/version.rb +1 -1
- data/postmark-rails.gemspec +1 -1
- data/spec/fixtures/models/test_mailer.rb +5 -0
- data/spec/fixtures/views/test_mailer/message_with_metadata.text.erb +1 -0
- data/spec/integration/delivery_spec.rb +9 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de1399f6f6c4c21b6ce4e3d28b4c8702e9fd7410
|
4
|
+
data.tar.gz: 78f14e32351eb47f2bd4237730b5e23dee2ee595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4c18bbc8e206fefc34ac08c200e9fde7ce704cb345bfb6e0d68afd92c93922a50b83638d5452c7b4fbfffc24a4cd53abc1fcc0f8206eec467e6112507981b17
|
7
|
+
data.tar.gz: 716982acabe1f138993fa8ae50d6789dd61814a483f87ee6ad9d69b1a3b5f9af62ef5d596d800161577c3ec6b725961c8b488f6a26975cdaf9c393c22da8490b
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -14,10 +14,10 @@ For Rails 2.3 please take a look at [version 0.4](https://github.com/wildbit/pos
|
|
14
14
|
|
15
15
|
## Configuring your Rails application
|
16
16
|
|
17
|
-
Add `postmark-rails` to your Gemfile
|
17
|
+
Add `postmark-rails` to your Gemfile and run `bundle install`.
|
18
18
|
|
19
19
|
``` ruby
|
20
|
-
gem 'postmark-rails'
|
20
|
+
gem 'postmark-rails'
|
21
21
|
```
|
22
22
|
|
23
23
|
Save your Postmark API token to [config/secrets.yml](http://guides.rubyonrails.org/4_1_release_notes.html#config-secrets-yml).
|
@@ -81,6 +81,25 @@ class TestMailer < ActionMailer::Base
|
|
81
81
|
end
|
82
82
|
```
|
83
83
|
|
84
|
+
## Attaching metadata to messages
|
85
|
+
|
86
|
+
Postmark supports [attaching metadata to messages](https://postmarkapp.com/support/article/1125-custom-metadata-faq-1). All metadata field values will be interpreted and returned in webhook payloads as strings.
|
87
|
+
|
88
|
+
``` ruby
|
89
|
+
class TestMailer < ActionMailer::Base
|
90
|
+
|
91
|
+
def message_with_metadata
|
92
|
+
metadata['foo'] = 'bar'
|
93
|
+
mail(
|
94
|
+
:subject => 'meta hello',
|
95
|
+
:to => 'sheldon@bigbangtheory.com',
|
96
|
+
:from => 'leonard@bigbangtheory.com'
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
84
103
|
## Sending in batches
|
85
104
|
|
86
105
|
While Postmark is focused on transactional email, we understand that developers
|
@@ -4,7 +4,7 @@ gemspec :path => '../'
|
|
4
4
|
|
5
5
|
gem 'json', '< 2.0.0'
|
6
6
|
gem 'rake', '< 11.0.0'
|
7
|
-
gem 'postmark', '~> 1.
|
7
|
+
gem 'postmark', '~> 1.13.0', :path => ENV['POSTMARK_GEM_PATH']
|
8
8
|
gem 'actionmailer', '~> 3.0.0'
|
9
9
|
gem 'rack-cache', '~> 1.2.0'
|
10
10
|
|
@@ -4,7 +4,7 @@ gemspec :path => '../'
|
|
4
4
|
|
5
5
|
gem 'json', '< 2.0.0'
|
6
6
|
gem 'rake', '< 11.0.0'
|
7
|
-
gem 'postmark', '~> 1.
|
7
|
+
gem 'postmark', '~> 1.13.0', :path => ENV['POSTMARK_GEM_PATH']
|
8
8
|
gem 'actionmailer', :github => 'rails', :branch => '3-2-stable'
|
9
9
|
gem 'i18n', '~> 0.6.0'
|
10
10
|
gem 'rack-cache', '~> 1.2.0'
|
data/lib/postmark-rails.rb
CHANGED
@@ -3,10 +3,19 @@ require 'action_mailer'
|
|
3
3
|
require 'postmark'
|
4
4
|
|
5
5
|
module PostmarkRails
|
6
|
-
|
6
|
+
module ActionMailerExtensions
|
7
|
+
def metadata
|
8
|
+
@_message.metadata
|
9
|
+
end
|
7
10
|
|
8
|
-
|
11
|
+
def metadata=(val)
|
12
|
+
@_message.metadata=(val)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.install
|
9
17
|
ActionMailer::Base.add_delivery_method :postmark, Mail::Postmark
|
18
|
+
ActionMailer::Base.send(:include, ActionMailerExtensions)
|
10
19
|
end
|
11
20
|
end
|
12
21
|
|
data/postmark-rails.gemspec
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
This is a message with metadata.
|
@@ -42,4 +42,12 @@ describe "Delivering messages with postmark-rails" do
|
|
42
42
|
expect { message.deliver }.to change{message.delivered?}.to(true)
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
it 'delivers a message with metadata' do
|
46
|
+
message = TestMailer.message_with_metadata
|
47
|
+
|
48
|
+
request = message.to_postmark_hash
|
49
|
+
|
50
|
+
expect(request['Metadata']).to eq('foo' => 'bar')
|
51
|
+
expect { message.deliver }.to change { message.delivered? }.to true
|
52
|
+
end
|
53
|
+
end
|
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.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petyo Ivanov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-03
|
13
|
+
date: 2018-07-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionmailer
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 1.
|
35
|
+
version: 1.13.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 1.
|
42
|
+
version: 1.13.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rake
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- spec/fixtures/models/test_mailer.rb
|
85
85
|
- spec/fixtures/views/test_mailer/message_with_attachment.erb
|
86
86
|
- spec/fixtures/views/test_mailer/message_with_inline_image.html.erb
|
87
|
+
- spec/fixtures/views/test_mailer/message_with_metadata.text.erb
|
87
88
|
- spec/fixtures/views/test_mailer/multipart_message.html.erb
|
88
89
|
- spec/fixtures/views/test_mailer/multipart_message.text.erb
|
89
90
|
- spec/fixtures/views/test_mailer/simple_message.erb
|
@@ -123,6 +124,7 @@ test_files:
|
|
123
124
|
- spec/fixtures/models/test_mailer.rb
|
124
125
|
- spec/fixtures/views/test_mailer/message_with_attachment.erb
|
125
126
|
- spec/fixtures/views/test_mailer/message_with_inline_image.html.erb
|
127
|
+
- spec/fixtures/views/test_mailer/message_with_metadata.text.erb
|
126
128
|
- spec/fixtures/views/test_mailer/multipart_message.html.erb
|
127
129
|
- spec/fixtures/views/test_mailer/multipart_message.text.erb
|
128
130
|
- spec/fixtures/views/test_mailer/simple_message.erb
|