postmark 1.21.7 → 1.22.1

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.
@@ -179,7 +179,7 @@ end
179
179
  describe(Postmark::InactiveRecipientError) do
180
180
  describe '.parse_recipients' do
181
181
  let(:recipients) do
182
- %w(nothing@wildbit.com noth.ing+2@wildbit.com noth.ing+2-1@wildbit.com)
182
+ %w(nothing@postmarkapp.com noth.ing+2@postmarkapp.com noth.ing+2-1@postmarkapp.com)
183
183
  end
184
184
 
185
185
  subject {Postmark::InactiveRecipientError.parse_recipients(message)}
@@ -2,32 +2,119 @@ require 'spec_helper'
2
2
 
3
3
  describe Postmark::HashHelper do
4
4
  describe ".to_postmark" do
5
- let(:source) { {:from => "support@postmarkapp.com", :reply_to => "contact@wildbit.com"} }
6
- let(:target) { {"From" => "support@postmarkapp.com", "ReplyTo" => "contact@wildbit.com"} }
5
+ let(:source) do
6
+ {
7
+ :level_one => {
8
+ :level_two => {
9
+ :level_three => [{ :array_item => 1 }]
10
+ }
11
+ }
12
+ }
13
+ end
14
+
15
+ describe 'default behaviour' do
16
+ let(:target) do
17
+ {
18
+ 'LevelOne' => {
19
+ :level_two => {
20
+ :level_three => [{ :array_item => 1 }]
21
+ }
22
+ }
23
+ }
24
+ end
25
+
26
+ it 'does not convert nested elements' do
27
+ expect(subject.to_postmark(source)).to eq(target)
28
+ end
29
+ end
30
+
31
+ describe 'deep conversion' do
32
+ let(:target) do
33
+ {
34
+ 'LevelOne' => {
35
+ 'LevelTwo' => {
36
+ 'LevelThree' => [{ 'ArrayItem' => 1 }]
37
+ }
38
+ }
39
+ }
40
+ end
7
41
 
8
- it 'converts Hash keys to Postmark format' do
9
- expect(subject.to_postmark(source)).to eq target
42
+ it 'converts nested elements when requested' do
43
+ expect(subject.to_postmark(source, :deep => true)).to eq(target)
44
+ end
10
45
  end
11
46
 
12
- it 'acts idempotentely' do
13
- expect(subject.to_postmark(target)).to eq target
47
+ it 'leaves CamelCase keys untouched' do
48
+ expect(subject.to_postmark('ReplyTo' => 'alice@example.com')).to eq('ReplyTo' => 'alice@example.com')
14
49
  end
15
50
  end
16
51
 
17
52
  describe ".to_ruby" do
18
- let(:source) { {"From" => "support@postmarkapp.com", "ReplyTo" => "contact@wildbit.com"} }
19
- let(:target) { {:from => "support@postmarkapp.com", :reply_to => "contact@wildbit.com"} }
53
+ let(:source) do
54
+ {
55
+ 'LevelOne' => {
56
+ 'LevelTwo' => {
57
+ 'LevelThree' => [{ 'ArrayItem' => 1 }]
58
+ }
59
+ }
60
+ }
61
+ end
20
62
 
21
- it 'converts Hash keys to Ruby format' do
22
- expect(subject.to_ruby(source)).to eq target
63
+ describe 'default behaviour' do
64
+ let(:target) do
65
+ {
66
+ :level_one => {
67
+ 'LevelTwo' => {
68
+ 'LevelThree' => [{ 'ArrayItem' => 1 }]
69
+ }
70
+ }
71
+ }
72
+ end
73
+
74
+ it 'does not convert nested elements' do
75
+ expect(subject.to_ruby(source)).to eq(target)
76
+ end
23
77
  end
24
78
 
25
- it 'has compatible mode' do
26
- expect(subject.to_ruby(source, true)).to eq target.merge(source)
79
+ describe 'deep conversion' do
80
+ let(:target) do
81
+ {
82
+ :level_one => {
83
+ :level_two => {
84
+ :level_three => [{ :array_item => 1 }]
85
+ }
86
+ }
87
+ }
88
+ end
89
+
90
+ it 'converts nested elements when requested' do
91
+ expect(subject.to_ruby(source, :deep => true)).to eq(target)
92
+ end
93
+ end
94
+
95
+ describe 'compatibility mode' do
96
+ let(:target) do
97
+ {
98
+ :level_one => {
99
+ 'LevelTwo' => {
100
+ 'LevelThree' => [{ 'ArrayItem' => 1 }]
101
+ }
102
+ },
103
+ 'LevelOne' => {
104
+ 'LevelTwo' => {
105
+ 'LevelThree' => [{ 'ArrayItem' => 1 }]
106
+ }
107
+ }
108
+ }
109
+ end
110
+
111
+ it 'preserves the original structure' do
112
+ expect(subject.to_ruby(source, :compatible => true)).to eq target
113
+ end
27
114
  end
28
115
 
29
- it 'acts idempotentely' do
30
- expect(subject.to_ruby(target)).to eq target
116
+ it 'leaves symbol keys untouched' do
117
+ expect(subject.to_ruby(:reply_to => 'alice@example.com')).to eq(:reply_to => 'alice@example.com')
31
118
  end
32
119
  end
33
120
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Postmark::Inbound do
4
4
  # http://developer.postmarkapp.com/developer-inbound-parse.html#example-hook
5
- let(:example_inbound) { '{"From":"myUser@theirDomain.com","FromFull":{"Email":"myUser@theirDomain.com","Name":"John Doe"},"To":"451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com","ToFull":[{"Email":"451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com","Name":""}],"Cc":"\"Full name\" <sample.cc@emailDomain.com>, \"Another Cc\" <another.cc@emailDomain.com>","CcFull":[{"Email":"sample.cc@emailDomain.com","Name":"Full name"},{"Email":"another.cc@emailDomain.com","Name":"Another Cc"}],"ReplyTo":"myUsersReplyAddress@theirDomain.com","Subject":"This is an inbound message","MessageID":"22c74902-a0c1-4511-804f2-341342852c90","Date":"Thu, 5 Apr 2012 16:59:01 +0200","MailboxHash":"ahoy","TextBody":"[ASCII]","HtmlBody":"[HTML(encoded)]","Tag":"","Headers":[{"Name":"X-Spam-Checker-Version","Value":"SpamAssassin 3.3.1 (2010-03-16) onrs-ord-pm-inbound1.wildbit.com"},{"Name":"X-Spam-Status","Value":"No"},{"Name":"X-Spam-Score","Value":"-0.1"},{"Name":"X-Spam-Tests","Value":"DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_PASS"},{"Name":"Received-SPF","Value":"Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.160.180; helo=mail-gy0-f180.google.com; envelope-from=myUser@theirDomain.com; receiver=451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com"},{"Name":"DKIM-Signature","Value":"v=1; a=rsa-sha256; c=relaxed\/relaxed; d=wildbit.com; s=google; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; bh=cYr\/+oQiklaYbBJOQU3CdAnyhCTuvemrU36WT7cPNt0=; b=QsegXXbTbC4CMirl7A3VjDHyXbEsbCUTPL5vEHa7hNkkUTxXOK+dQA0JwgBHq5C+1u iuAJMz+SNBoTqEDqte2ckDvG2SeFR+Edip10p80TFGLp5RucaYvkwJTyuwsA7xd78NKT Q9ou6L1hgy\/MbKChnp2kxHOtYNOrrszY3JfQM="},{"Name":"MIME-Version","Value":"1.0"},{"Name":"Message-ID","Value":"<CAGXpo2WKfxHWZ5UFYCR3H_J9SNMG+5AXUovfEFL6DjWBJSyZaA@mail.gmail.com>"}],"Attachments":[{"Name":"myimage.png","Content":"[BASE64-ENCODED CONTENT]","ContentType":"image/png","ContentLength":4096},{"Name":"mypaper.doc","Content":"[BASE64-ENCODED CONTENT]","ContentType":"application/msword","ContentLength":16384}]}' }
5
+ let(:example_inbound) { '{"From":"myUser@theirDomain.com","FromFull":{"Email":"myUser@theirDomain.com","Name":"John Doe"},"To":"451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com","ToFull":[{"Email":"451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com","Name":""}],"Cc":"\"Full name\" <sample.cc@emailDomain.com>, \"Another Cc\" <another.cc@emailDomain.com>","CcFull":[{"Email":"sample.cc@emailDomain.com","Name":"Full name"},{"Email":"another.cc@emailDomain.com","Name":"Another Cc"}],"ReplyTo":"myUsersReplyAddress@theirDomain.com","Subject":"This is an inbound message","MessageID":"22c74902-a0c1-4511-804f2-341342852c90","Date":"Thu, 5 Apr 2012 16:59:01 +0200","MailboxHash":"ahoy","TextBody":"[ASCII]","HtmlBody":"[HTML(encoded)]","Tag":"","Headers":[{"Name":"X-Spam-Checker-Version","Value":"SpamAssassin 3.3.1 (2010-03-16) onrs-ord-pm-inbound1.postmarkapp.com"},{"Name":"X-Spam-Status","Value":"No"},{"Name":"X-Spam-Score","Value":"-0.1"},{"Name":"X-Spam-Tests","Value":"DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_PASS"},{"Name":"Received-SPF","Value":"Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.160.180; helo=mail-gy0-f180.google.com; envelope-from=myUser@theirDomain.com; receiver=451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com"},{"Name":"DKIM-Signature","Value":"v=1; a=rsa-sha256; c=relaxed\/relaxed; d=postmarkapp.com; s=google; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; bh=cYr\/+oQiklaYbBJOQU3CdAnyhCTuvemrU36WT7cPNt0=; b=QsegXXbTbC4CMirl7A3VjDHyXbEsbCUTPL5vEHa7hNkkUTxXOK+dQA0JwgBHq5C+1u iuAJMz+SNBoTqEDqte2ckDvG2SeFR+Edip10p80TFGLp5RucaYvkwJTyuwsA7xd78NKT Q9ou6L1hgy\/MbKChnp2kxHOtYNOrrszY3JfQM="},{"Name":"MIME-Version","Value":"1.0"},{"Name":"Message-ID","Value":"<CAGXpo2WKfxHWZ5UFYCR3H_J9SNMG+5AXUovfEFL6DjWBJSyZaA@mail.gmail.com>"}],"Attachments":[{"Name":"myimage.png","Content":"[BASE64-ENCODED CONTENT]","ContentType":"image/png","ContentLength":4096},{"Name":"mypaper.doc","Content":"[BASE64-ENCODED CONTENT]","ContentType":"application/msword","ContentLength":16384}]}' }
6
6
 
7
7
  context "given a serialized inbound document" do
8
8
  subject { Postmark::Inbound.to_ruby_hash(example_inbound) }
@@ -219,9 +219,9 @@ describe Mail::Message do
219
219
 
220
220
  describe "#export_headers" do
221
221
  let(:mail_message_with_reserved_headers) do
222
- mail_message.header['Return-Path'] = 'bounce@wildbit.com'
223
- mail_message.header['From'] = 'info@wildbit.com'
224
- mail_message.header['Sender'] = 'info@wildbit.com'
222
+ mail_message.header['Return-Path'] = 'bounce@postmarkapp.com'
223
+ mail_message.header['From'] = 'info@postmarkapp.com'
224
+ mail_message.header['Sender'] = 'info@postmarkapp.com'
225
225
  mail_message.header['Received'] = 'from mta.pstmrk.it ([72.14.252.155]:54907)'
226
226
  mail_message.header['Date'] = 'January 25, 2013 3:30:58 PM PDT'
227
227
  mail_message.header['Content-Type'] = 'application/json'
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.21.7
4
+ version: 1.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomek Maszkowski
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-07-22 00:00:00.000000000 Z
16
+ date: 2022-06-22 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: json
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '0'
60
60
  description: Use this gem to send emails through Postmark HTTP API and retrieve info
61
61
  about bounces.
62
- email: tomek@wildbit.com
62
+ email:
63
63
  executables: []
64
64
  extensions: []
65
65
  extra_rdoc_files:
@@ -71,6 +71,8 @@ files:
71
71
  - ".gitignore"
72
72
  - ".rake_tasks"
73
73
  - ".rspec"
74
+ - ".ruby-gemset"
75
+ - ".ruby-version"
74
76
  - CHANGELOG.rdoc
75
77
  - CONTRIBUTING.md
76
78
  - Gemfile
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
152
  - !ruby/object:Gem::Version
151
153
  version: 1.3.7
152
154
  requirements: []
153
- rubygems_version: 3.2.3
155
+ rubygems_version: 3.0.9
154
156
  signing_key:
155
157
  specification_version: 4
156
158
  summary: Official Postmark API wrapper.