postmark 1.12.0 → 1.13.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: 7d65fe77b30becc8c00a0e19a057d885176f20dd
4
- data.tar.gz: df33b575861a790eaea91e65ff7d937fd7c0be03
3
+ metadata.gz: b3eb03641468ddcbee6aab9cdc449257f5bb309c
4
+ data.tar.gz: 19f4463b421ead1daae9e1121a1a24e5a4485c98
5
5
  SHA512:
6
- metadata.gz: 001d1b715e69f99ee6eb3a7f1dc63f282f51ef1b8dbe3acf42344e4c421cbc8d5cd23f269c2525460499d4d8ece1f7060355e747bb758024f0ffbcfe9aa5bf5e
7
- data.tar.gz: 83ad3ace1faa7086fd327afdd2676737aeae6130fe4f9013e79e291984e0a8bab0f47e44247aa518f41d49fca04aed686e5afa9ced07ba4821621debc1131569
6
+ metadata.gz: ad68cc4ef04239f9a222d0a9426e9d0c8b8bdd696741990ff06076e34c8d4e1a9ff1ebaec7f0f2539ddd3b8147fba3c311286988f519b8121aa5ea71e9687a42
7
+ data.tar.gz: 356a337ee74c68a196f11110537a2ab525ec4d446e597c32c8df0fb69166e03ef67aa0d317a3904cfe5c00cec39729c78be5c21c654919efa40ef972b395c8ea
@@ -1,5 +1,10 @@
1
1
  = Changelog
2
2
 
3
+ == 1.13.0
4
+
5
+ * Changed default value returned by Mail::Message#metadata to a mutable hash (makes things easier for postmark-rails).
6
+ * All message JSON payloads now include an empty metadata object even if metadata is unset.
7
+
3
8
  == 1.12.0
4
9
 
5
10
  * Added support for attaching metadata to messages.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.12.0
1
+ 1.13.0
@@ -32,7 +32,7 @@ module Postmark
32
32
  'Tag' => @message.tag.to_s,
33
33
  'TrackOpens' => (cast_to_bool(@message.track_opens) unless @message.track_opens.empty?),
34
34
  'TrackLinks' => (::Postmark::Inflector.to_postmark(@message.track_links) unless @message.track_links.empty?),
35
- 'Metadata' => (@message.metadata unless @message.metadata.nil?)
35
+ 'Metadata' => @message.metadata
36
36
  }
37
37
  end
38
38
 
@@ -34,8 +34,11 @@ module Mail
34
34
  end
35
35
 
36
36
  def metadata(val = nil)
37
- @metadata=val unless val.nil?
38
- @metadata
37
+ if val
38
+ @metadata = val
39
+ else
40
+ @metadata ||= {}
41
+ end
39
42
  end
40
43
 
41
44
  def metadata=(val)
@@ -1,3 +1,3 @@
1
1
  module Postmark
2
- VERSION = '1.12.0'
2
+ VERSION = '1.13.0'
3
3
  end
@@ -328,7 +328,7 @@ describe Postmark::MailMessageConverter do
328
328
 
329
329
  it 'converts multiple metadata fields' do
330
330
  metadata = {}
331
- metadata = 10.times { |i| metadata["test#{i+1}"] = "t"*80 }
331
+ 10.times { |i| metadata["test#{i+1}"] = "t"*80 }
332
332
  msg = mail_html_message
333
333
  msg.metadata = metadata
334
334
  expect(subject.new(msg).run).to include('Metadata' => metadata)
@@ -88,24 +88,20 @@ describe Mail::Message do
88
88
  end
89
89
 
90
90
  describe '#metadata' do
91
- let(:metadata) {{:test => "test"}}
91
+ let(:metadata) { { :test => 'test' } }
92
92
 
93
- it 'returns nil if unset' do
94
- expect(mail_message.metadata).to eq nil
93
+ it 'returns a mutable empty hash if unset' do
94
+ expect(mail_message.metadata).to eq({})
95
+ expect(mail_message.metadata.equal?(mail_message.metadata)).to be true
95
96
  end
96
97
 
97
- context 'when assigned via #metadata=' do
98
- it 'returns assigned value' do
99
- mail_message.metadata=metadata
100
- expect(mail_message.metadata).to eq metadata
101
- end
98
+ it 'supports assigning non-null values (for the builder DSL)' do
99
+ expect { mail_message.metadata(metadata) }.to change { mail_message.metadata }.to(metadata)
100
+ expect { mail_message.metadata(nil) }.to_not change { mail_message.metadata }
102
101
  end
103
102
 
104
- context 'when assigned via metadata()' do
105
- it 'returns assigned value' do
106
- mail_message.metadata(metadata)
107
- expect(mail_message.metadata).to eq metadata
108
- end
103
+ it 'returns value assigned via metadata=' do
104
+ expect { mail_message.metadata = metadata }.to change { mail_message.metadata }.to(metadata)
109
105
  end
110
106
  end
111
107
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.13.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-07-02 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: rake