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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11103f47e603b5ae549757fb861bff414067ca90
4
- data.tar.gz: 862e1cb8268be1498a138440ba5abb63ea4a8045
3
+ metadata.gz: de1399f6f6c4c21b6ce4e3d28b4c8702e9fd7410
4
+ data.tar.gz: 78f14e32351eb47f2bd4237730b5e23dee2ee595
5
5
  SHA512:
6
- metadata.gz: eaf79340d2482125dd51cf6b380c5bc33aac14bb2718a46735bea798df0ef185a68ee94509129a011369014e4978588f3d2f0c39ba71aaa4162668b4dc745f20
7
- data.tar.gz: b260ee5d8aa82bcbd7492fb91a812faac8365dd18d0ae95ce4a2e6714ad9750964e7dba32c1a167b030b5f38a9460336f3cb06246dbfd739d268bf3611a6ff3c
6
+ metadata.gz: f4c18bbc8e206fefc34ac08c200e9fde7ce704cb345bfb6e0d68afd92c93922a50b83638d5452c7b4fbfffc24a4cd53abc1fcc0f8206eec467e6112507981b17
7
+ data.tar.gz: 716982acabe1f138993fa8ae50d6789dd61814a483f87ee6ad9d69b1a3b5f9af62ef5d596d800161577c3ec6b725961c8b488f6a26975cdaf9c393c22da8490b
@@ -1,5 +1,10 @@
1
1
  = Changelog
2
2
 
3
+ == 0.17.0
4
+
5
+ * Add support for metadata.
6
+ * Update the postmark gem dependency to 1.13.x.
7
+
3
8
  == 0.16.0
4
9
 
5
10
  * Update the postmark gem dependency to 1.11.x.
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 (change version numbers if needed) and run `bundle install`.
17
+ Add `postmark-rails` to your Gemfile and run `bundle install`.
18
18
 
19
19
  ``` ruby
20
- gem 'postmark-rails', '~> 0.15.0'
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.11.0', :path => ENV['POSTMARK_GEM_PATH']
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.11.0', :path => ENV['POSTMARK_GEM_PATH']
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'
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec :path => '../'
4
4
 
5
5
  gem 'json', '< 2.0.0'
6
- gem 'postmark', '~> 1.11.0', path: ENV['POSTMARK_GEM_PATH']
6
+ gem 'postmark', '~> 1.13.0', path: ENV['POSTMARK_GEM_PATH']
7
7
  gem 'actionmailer', '~> 4.0.0'
8
8
 
9
9
  group :test do
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec :path => '../'
4
4
 
5
5
  gem 'json', '< 2.0.0'
6
- gem 'postmark', '~> 1.11.0', path: ENV['POSTMARK_GEM_PATH']
6
+ gem 'postmark', '~> 1.13.0', path: ENV['POSTMARK_GEM_PATH']
7
7
  gem 'actionmailer', '~> 4.1.0'
8
8
 
9
9
  group :test do
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec :path => '../'
4
4
 
5
5
  gem 'json', '< 2.0.0'
6
- gem 'postmark', '~> 1.11.0', path: ENV['POSTMARK_GEM_PATH']
6
+ gem 'postmark', '~> 1.13.0', path: ENV['POSTMARK_GEM_PATH']
7
7
  gem 'actionmailer', '~> 4.2.0'
8
8
 
9
9
  group :test do
@@ -3,10 +3,19 @@ require 'action_mailer'
3
3
  require 'postmark'
4
4
 
5
5
  module PostmarkRails
6
- extend self
6
+ module ActionMailerExtensions
7
+ def metadata
8
+ @_message.metadata
9
+ end
7
10
 
8
- def install
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
 
@@ -1,3 +1,3 @@
1
1
  module PostmarkRails
2
- VERSION = '0.16.0'
2
+ VERSION = '0.17.0'
3
3
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.rdoc_options = ["--charset=UTF-8"]
18
18
 
19
19
  s.add_dependency('actionmailer', ">= 3.0.0")
20
- s.add_dependency('postmark', "~> 1.11.0")
20
+ s.add_dependency('postmark', "~> 1.13.0")
21
21
 
22
22
  s.add_development_dependency("rake")
23
23
 
@@ -32,6 +32,11 @@ class TestMailer < ActionMailer::Base
32
32
  mail(:subject => "Message with inline image.")
33
33
  end
34
34
 
35
+ def message_with_metadata
36
+ metadata['foo'] = 'bar'
37
+ mail(:subject => 'Message with metadata.')
38
+ end
39
+
35
40
  protected
36
41
 
37
42
  def image_file
@@ -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
- end
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.16.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-14 00:00:00.000000000 Z
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.11.0
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.11.0
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