postmark 1.17.0 → 1.18.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
  SHA256:
3
- metadata.gz: 3f7b40fc4752d18a1e0c14357f256540b7324cf5eb5e919075f8970db47c88f2
4
- data.tar.gz: 7169e072affbaced002b978a6b206723f6b494aa520dba8587bf01784e160139
3
+ metadata.gz: 3483ee7403059d95be73f52b76f383260f74e5799d9e7bff9da45ebfeb354668
4
+ data.tar.gz: a2c1e8e611a41862c3e65ae7da38957c2441b87675f7033c3fb5154389276196
5
5
  SHA512:
6
- metadata.gz: 5ab871fbf075102964bae2a5abb888e85514c1cd1e7d6b4a060bfeaf048ec021d0ea40ac389af785757e47b5fce9525bc2b926e7af63385cb0f2ee05d56d7890
7
- data.tar.gz: 67d33ea5395c6c36d03a7081d8cf56d7517feb6877540aac7e5e612b57bd065ffc7932367ee175ea8999f125d2ead1b1377cfe4f5858f6ffcad5dfa0ce89e01f
6
+ metadata.gz: 0c8eddecfa0c578503694fb5768987bbba25a67c55d5039c34f5cbf743bbdbc0ecd42b04c4613862acb13c94a003bc4fad0d7e6b29a24391dbc790ebd04da558
7
+ data.tar.gz: 97e52b184eb0e4256639bf17821019f945a86770dfdc0f5f51527726aa28ef2f009de36993d203dcaf1f4cc726edc7fa279e092e156c92b155d348e599cbbcff
@@ -5,9 +5,9 @@ env:
5
5
  # POSTMARK_ACCOUNT_API_KEY=?
6
6
  - secure: "lau1m+ws6T5LBiRXwd+Q0b20Wjh62W/nHnCmzOSZc2+V97XTldl3MCJdXNV7J6X7O9CzFabcAG8FSbGGwPRiyhY/qhxkYSc/9pWE8RUjyCjbw5q2RzZQelMKizyKU92eOjd6jQw/wDSZcww1OceW/pgdRjqEo21Pk6XH2yzLAd8="
7
7
  # POSTMARK_CI_RECIPIENT=?
8
- - secure: "V5GeJn1rch72qcAz/YI9tSEnZ2Zb4utWzq9ntr9gojRVFGpocgIbULmeslTKyIN7s5kF23qnhsGmPA9Olwz1ZqV9zhdWcsm4PUhUU/n3tVAnLWpUDjeneD5P+IOO6S+bCzVZX+Gk5/agBt2bQeAbVe+lVh5RZQJc3lsEvkVv7QM="
8
+ - secure: "YnccT2MM+hIfwxl1WtcTk48q+D9XY7p6FTHkeJbUoaT9PFXQqXyUCQpwk5wYAwzZbVWG/CgH4PitWyRbWBP6kAqYKlsnAkQip0FNjs0DbK0SH9YvcFFSDZsTAl9yfwSxlgnBZHGZ49LO3yISMPUOdNn1QmaF4Ndpl4hiycH7UA8="
9
9
  # POSTMARK_CI_SENDER=?
10
- - secure: "qP1h4CajeKaVL7cUF3G9cKCm+KBjcTjTKRC3uOVN+X5dgQZFAuMQ9oJ3k1868AFMEJ2qqqfLCm177SlDXxqSisR7MEcCDIchiE+gUGH0YqZKLEYONyl00ts3/A6iMkQCODEB+kzLZAlByziO3CDZ6bHeLb6f7UJ4ExCSCQMYIyc="
10
+ - secure: "Cz/KfiXkd90GQr+47LunlZnal8clrRpKmZUd9K161RYd5bfkL+P6SnEmhMprwdzomUBqIcqleR9HjmECey2V/Zd9V8vtBaLVZ5CoeMTkz3Tu6SllfmpymkcuJKf7GGizs97gmhPMlJd9iMukL6eqW4/1C9HW0cLZFB/jlzqFHpE="
11
11
  language: ruby
12
12
  rvm:
13
13
  - 2.0.0
@@ -143,10 +143,8 @@ module Mail
143
143
  [].tap do |headers|
144
144
  self.header.fields.each do |field|
145
145
  key, value = field.name, field.value
146
- next if bogus_headers.include? key.downcase
147
- name = key.split(/-/).map { |i| i.capitalize }.join('-')
148
-
149
- headers << { "Name" => name, "Value" => value }
146
+ next if reserved_headers.include? key.downcase
147
+ headers << { "Name" => key, "Value" => value }
150
148
  end
151
149
  end
152
150
  end
@@ -173,7 +171,7 @@ module Mail
173
171
  end
174
172
  end
175
173
 
176
- def bogus_headers
174
+ def reserved_headers
177
175
  %q[
178
176
  return-path x-pm-rcpt
179
177
  from reply-to
@@ -1,3 +1,3 @@
1
1
  module Postmark
2
- VERSION = '1.17.0'
2
+ VERSION = '1.18.0'
3
3
  end
@@ -8,12 +8,9 @@ describe 'Account API client usage' do
8
8
  let(:unique_token) { rand(36**32).to_s(36) }
9
9
  let(:unique_from_email) { ENV['POSTMARK_CI_SENDER'].gsub(/(\+.+)?@/, "+#{unique_token}@") }
10
10
 
11
- it 'can be used to manage senders' do
12
- new_sender = nil
13
-
11
+ it 'manage senders' do
14
12
  # create & count
15
- new_sender = subject.create_sender(:name => 'Integration Test',
16
- :from_email => unique_from_email)
13
+ new_sender = subject.create_sender(:name => 'Integration Test', :from_email => unique_from_email)
17
14
  expect(subject.get_senders_count).to be > 0
18
15
 
19
16
  # get
@@ -47,8 +44,7 @@ describe 'Account API client usage' do
47
44
  expect { subject.delete_sender(new_sender[:id]) }.not_to raise_error
48
45
  end
49
46
 
50
- it 'can be used to manage domains' do
51
- new_domain = nil
47
+ it 'manage domains' do
52
48
  domain_name = "#{unique_token}-gem-integration.test"
53
49
  return_path = "return.#{domain_name}"
54
50
  updated_return_path = "updated-return.#{domain_name}"
@@ -85,9 +81,7 @@ describe 'Account API client usage' do
85
81
  expect { subject.delete_domain(new_domain[:id]) }.not_to raise_error
86
82
  end
87
83
 
88
- it 'can be used to manage servers' do
89
- new_server = nil
90
-
84
+ it 'manage servers' do
91
85
  # create & count
92
86
  new_server = subject.create_server(:name => "server-#{unique_token}",
93
87
  :color => 'red')
@@ -111,5 +105,4 @@ describe 'Account API client usage' do
111
105
  # delete
112
106
  expect { subject.delete_server(new_server[:id]) }.not_to raise_error
113
107
  end
114
-
115
108
  end
@@ -17,11 +17,7 @@ describe "Sending Mail::Messages with delivery_method Mail::Postmark" do
17
17
  end
18
18
  }
19
19
 
20
- let(:tagged_message) {
21
- message.tap do |m|
22
- m.tag "postmark-gem"
23
- end
24
- }
20
+ let(:tagged_message) { message.tap { |m| m.tag "postmark-gem" } }
25
21
 
26
22
  let(:message_with_no_body) {
27
23
  Mail.new do
@@ -54,34 +50,36 @@ describe "Sending Mail::Messages with delivery_method Mail::Postmark" do
54
50
  end
55
51
 
56
52
  it 'updates a message object with X-PM-Message-Id' do
57
- expect { message.deliver }.
58
- to change{message['X-PM-Message-Id'].to_s}.to(postmark_message_id_format)
53
+ expect { message.deliver }.to change{message['X-PM-Message-Id'].to_s}.to(postmark_message_id_format)
59
54
  end
60
55
 
61
56
  it 'updates a message object with full postmark response' do
62
- expect { message.deliver }.
63
- to change{message.postmark_response}.from(nil)
57
+ expect { message.deliver }.to change{message.postmark_response}.from(nil)
64
58
  end
65
59
 
66
60
  it 'delivers a tagged message' do
67
- expect { tagged_message.deliver }.
68
- to change{message.delivered?}.to(true)
61
+ expect { tagged_message.deliver }.to change{message.delivered?}.to(true)
69
62
  end
70
63
 
71
64
  it 'delivers a message with attachment' do
72
- expect { message_with_attachment.deliver }.
73
- to change{message_with_attachment.delivered?}.to(true)
65
+ expect { message_with_attachment.deliver }.to change{message_with_attachment.delivered?}.to(true)
74
66
  end
75
67
 
76
- it 'fails to deliver a message without body' do
77
- expect { message_with_no_body.deliver! }.
78
- to raise_error(Postmark::InvalidMessageError)
79
- message_with_no_body.should_not be_delivered
80
- end
68
+ context 'fails to deliver a message' do
69
+ it ' without body - raise error' do
70
+ expect { message_with_no_body.deliver! }.to raise_error(Postmark::InvalidMessageError)
71
+ end
81
72
 
82
- it 'fails to deliver a message with invalid To address' do
83
- expect { message_with_invalid_to.deliver! }.
84
- to raise_error(Postmark::InvalidMessageError)
85
- message_with_invalid_to.should_not be_delivered
73
+ it 'without body - do not deliver' do
74
+ expect(message_with_no_body).not_to be_delivered
75
+ end
76
+
77
+ it 'with invalid To address - raise error' do
78
+ expect { message_with_invalid_to.deliver! }.to raise_error(Postmark::InvalidMessageError)
79
+ end
80
+
81
+ it 'with invalid To address - do not deliver' do
82
+ expect(message_with_invalid_to).not_to be_delivered
83
+ end
86
84
  end
87
85
  end
@@ -6,7 +6,7 @@ end
6
6
 
7
7
  describe(Postmark::HttpClientError) do
8
8
  it { is_expected.to be_a(Postmark::Error) }
9
- specify { expect(subject.retry?).to be true }
9
+ it { expect(subject.retry?).to be true }
10
10
  end
11
11
 
12
12
  describe(Postmark::HttpServerError) do
@@ -85,7 +85,7 @@ describe(Postmark::ApiInputError) do
85
85
 
86
86
  shared_examples_for 'api input error' do
87
87
  its(:status_code) { is_expected. to eq 422 }
88
- specify { expect(subject.retry?).to be false }
88
+ it { expect(subject.retry?).to be false }
89
89
  it { is_expected.to be_a(Postmark::ApiInputError) }
90
90
  it { is_expected.to be_a(Postmark::HttpServerError) }
91
91
  end
@@ -117,7 +117,7 @@ end
117
117
 
118
118
  describe(Postmark::TimeoutError) do
119
119
  it { is_expected.to be_a(Postmark::Error) }
120
- specify { expect(subject.retry?).to be true }
120
+ it { expect(subject.retry?).to be true }
121
121
  end
122
122
 
123
123
  describe(Postmark::UnknownMessageType) do
@@ -33,25 +33,6 @@ describe Mail::Message do
33
33
  end
34
34
  end
35
35
 
36
- let(:mail_message_with_bogus_headers) do
37
- mail_message.header['Return-Path'] = 'bounce@wildbit.com'
38
- mail_message.header['From'] = 'info@wildbit.com'
39
- mail_message.header['Sender'] = 'info@wildbit.com'
40
- mail_message.header['Received'] = 'from mta.pstmrk.it ([72.14.252.155]:54907)'
41
- mail_message.header['Date'] = 'January 25, 2013 3:30:58 PM PDT'
42
- mail_message.header['Content-Type'] = 'application/json'
43
- mail_message.header['To'] = 'lenard@bigbangtheory.com'
44
- mail_message.header['Cc'] = 'sheldon@bigbangtheory.com'
45
- mail_message.header['Bcc'] = 'penny@bigbangtheory.com'
46
- mail_message.header['Subject'] = 'You want not to use a bogus header'
47
- mail_message.header['Tag'] = 'bogus-tag'
48
- mail_message.header['Attachment'] = 'anydatahere'
49
- mail_message.header['Allowed-Header'] = 'value'
50
- mail_message.header['TRACK-OPENS'] = 'true'
51
- mail_message.header['TRACK-LINKS'] = 'HtmlOnly'
52
- mail_message
53
- end
54
-
55
36
  describe '#tag' do
56
37
 
57
38
  it 'value set on tag=' do
@@ -237,11 +218,42 @@ describe Mail::Message do
237
218
  end
238
219
 
239
220
  describe "#export_headers" do
240
- let(:headers) { mail_message_with_bogus_headers.export_headers }
241
- let(:header_names) { headers.map { |h| h['Name'] } }
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'
225
+ mail_message.header['Received'] = 'from mta.pstmrk.it ([72.14.252.155]:54907)'
226
+ mail_message.header['Date'] = 'January 25, 2013 3:30:58 PM PDT'
227
+ mail_message.header['Content-Type'] = 'application/json'
228
+ mail_message.header['To'] = 'lenard@bigbangtheory.com'
229
+ mail_message.header['Cc'] = 'sheldon@bigbangtheory.com'
230
+ mail_message.header['Bcc'] = 'penny@bigbangtheory.com'
231
+ mail_message.header['Subject'] = 'You want not to use a bogus header'
232
+ mail_message.header['Tag'] = 'bogus-tag'
233
+ mail_message.header['Attachment'] = 'anydatahere'
234
+ mail_message.header['Allowed-Header'] = 'value'
235
+ mail_message.header['TRACK-OPENS'] = 'true'
236
+ mail_message.header['TRACK-LINKS'] = 'HtmlOnly'
237
+ mail_message
238
+ end
239
+
240
+
241
+ it 'only allowed headers' do
242
+ headers = mail_message_with_reserved_headers.export_headers
243
+ header_names = headers.map { |h| h['Name'] }
242
244
 
243
- specify { expect(header_names).to include('Allowed-Header') }
244
- specify { expect(header_names.count).to eq 1 }
245
+ aggregate_failures do
246
+ expect(header_names).to include('Allowed-Header')
247
+ expect(header_names.count).to eq 1
248
+ end
249
+ end
250
+
251
+ it 'custom header character case preserved' do
252
+ custom_header = {"Name"=>"custom-Header", "Value"=>"cUsTomHeaderValue"}
253
+ mail_message.header[custom_header['Name']] = custom_header['Value']
254
+
255
+ expect(mail_message.export_headers.first).to match(custom_header)
256
+ end
245
257
  end
246
258
 
247
259
  describe "#to_postmark_hash" do
@@ -249,8 +261,8 @@ describe Mail::Message do
249
261
  end
250
262
 
251
263
  describe '#templated?' do
252
- specify { expect(mail_message).to_not be_templated }
253
- specify { expect(templated_message).to be_templated }
264
+ it { expect(mail_message).to_not be_templated }
265
+ it { expect(templated_message).to be_templated }
254
266
  end
255
267
 
256
268
  describe '#prerender' do
@@ -317,7 +329,7 @@ describe Mail::Message do
317
329
  context 'and using a non-Postmark delivery method' do
318
330
  let(:delivery_method) { Mail::SMTP }
319
331
 
320
- specify { expect { rendering }.to raise_error(Postmark::MailAdapterError) }
332
+ it { expect { rendering }.to raise_error(Postmark::MailAdapterError) }
321
333
  end
322
334
 
323
335
  context 'and using a Postmark delivery method' do
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.17.0
4
+ version: 1.18.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: 2019-08-19 00:00:00.000000000 Z
13
+ date: 2019-09-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json