postmark 1.24.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +33 -14
- data/.ruby-version +1 -1
- data/CHANGELOG.rdoc +7 -0
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/gemfiles/Gemfile.legacy +2 -0
- data/lib/postmark/account_api_client.rb +8 -1
- data/lib/postmark/bounce.rb +5 -1
- data/lib/postmark/message_extensions/mail.rb +6 -6
- data/lib/postmark/version.rb +1 -1
- data/postmark.gemspec +1 -1
- data/spec/integration/account_api_client_spec.rb +16 -0
- data/spec/unit/postmark/account_api_client_spec.rb +41 -0
- data/spec/unit/postmark/bounce_spec.rb +10 -0
- data/spec/unit/postmark/mail_message_converter_spec.rb +2 -2
- data/spec/unit/postmark/message_extensions/mail_spec.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b36e7eff4dabb977637da4527446a61f1f5b1907b0d327fefee9b9068f9ee874
|
4
|
+
data.tar.gz: c65b4c7bb6b1e7529f3b202d93e0898fdb51a067ae8496a8c8ae04b0eca9eb48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 122e2d925a0dcff98d93fbd60d11db94c5e8f443b73cf67a20eea839a07fd4955fcf0e782a1e49bc3ee9abf0593f8d513a957e6541bc6774ecfb1b1268d152d9
|
7
|
+
data.tar.gz: 7db9801b4d8cbdb47c6d8b277d03871ea40ccacb62df06e10169f61cf3368c416e41699a65cfd0f667e0889df7c88e796b0ae4fbac30832a84644644ff63bfdf
|
data/.circleci/config.yml
CHANGED
@@ -9,11 +9,25 @@ workflows:
|
|
9
9
|
- unit-tests:
|
10
10
|
matrix:
|
11
11
|
parameters:
|
12
|
-
version: [
|
12
|
+
version: [
|
13
|
+
"circleci/ruby:2",
|
14
|
+
"circleci/ruby:2.1",
|
15
|
+
"circleci/ruby:2.2",
|
16
|
+
"circleci/ruby:2.3",
|
17
|
+
"circleci/ruby:2.4",
|
18
|
+
"circleci/ruby:2.5",
|
19
|
+
"circleci/ruby:2.6",
|
20
|
+
"circleci/ruby:2.7",
|
21
|
+
"cimg/ruby:3.2"
|
22
|
+
]
|
13
23
|
- unit-tests-legacy:
|
14
24
|
matrix:
|
15
25
|
parameters:
|
16
|
-
version: [
|
26
|
+
version: [
|
27
|
+
"kneip/ree-1.8.7-2012.02",
|
28
|
+
"ruby:1.9.3",
|
29
|
+
"circleci/jruby:9"
|
30
|
+
]
|
17
31
|
|
18
32
|
orbs:
|
19
33
|
ruby: circleci/ruby@0.1.2
|
@@ -25,21 +39,16 @@ jobs:
|
|
25
39
|
version:
|
26
40
|
type: string
|
27
41
|
docker:
|
28
|
-
- image:
|
42
|
+
- image: << parameters.version >>
|
29
43
|
steps:
|
30
44
|
- checkout
|
31
|
-
-
|
32
|
-
name: Versions
|
33
|
-
command: |
|
34
|
-
echo "ruby: $(ruby --version)"
|
45
|
+
- check_version
|
35
46
|
|
36
47
|
- run:
|
37
48
|
name: Install dependencies
|
38
49
|
command: bundle install
|
39
50
|
|
40
|
-
-
|
41
|
-
name: Run tests
|
42
|
-
command: bundle exec rake spec
|
51
|
+
- run_tests
|
43
52
|
|
44
53
|
unit-tests-legacy:
|
45
54
|
parallelism: 1
|
@@ -52,10 +61,7 @@ jobs:
|
|
52
61
|
- image: << parameters.version >>
|
53
62
|
steps:
|
54
63
|
- checkout
|
55
|
-
-
|
56
|
-
name: Versions
|
57
|
-
command: |
|
58
|
-
echo "ruby: $(ruby --version)"
|
64
|
+
- check_version
|
59
65
|
|
60
66
|
- run:
|
61
67
|
name: Install dependencies
|
@@ -63,6 +69,19 @@ jobs:
|
|
63
69
|
gem install bundler --version 1.17.3
|
64
70
|
bundle install
|
65
71
|
|
72
|
+
- run_tests
|
73
|
+
|
74
|
+
commands:
|
75
|
+
check_version:
|
76
|
+
steps:
|
77
|
+
- run:
|
78
|
+
name: Check Ruby version
|
79
|
+
command: |
|
80
|
+
echo "ruby: $(ruby --version)"
|
81
|
+
run_tests:
|
82
|
+
steps:
|
66
83
|
- run:
|
67
84
|
name: Run tests
|
68
85
|
command: bundle exec rake spec
|
86
|
+
- store_test_results:
|
87
|
+
path: test-results
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-3.2.2
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
|
+
== 1.25.0
|
4
|
+
* Add support for https://postmarkapp.com/developer/api/data-removals-api
|
5
|
+
|
6
|
+
== 1.24.1
|
7
|
+
* Fixed support for text/calendar attachments by using content_type instead of mime_type.
|
8
|
+
* Added missing fields to Bounce
|
9
|
+
|
3
10
|
== 1.24.0
|
4
11
|
* Added configurable warnings when referencing deprecated classes.
|
5
12
|
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ source "http://rubygems.org"
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem 'rspec', '~> 3.7'
|
7
|
+
gem 'rspec', '~> 3.7', "< 3.10" # until https://github.com/rspec/rspec-support/pull/537 gets merged
|
8
8
|
gem 'rspec-its', '~> 1.2'
|
9
9
|
gem 'fakeweb', :git => 'https://github.com/chrisk/fakeweb.git'
|
10
10
|
gem 'fakeweb-matcher'
|
data/README.md
CHANGED
@@ -73,8 +73,8 @@ Refer to the [LICENSE](https://github.com/ActiveCampaign/postmark-gem/blob/main/
|
|
73
73
|
|
74
74
|
## Tests
|
75
75
|
|
76
|
-
The [integration tests](https://github.com/ActiveCampaign/postmark-gem/tree/main/spec/integration) currently use a real test email address, configured via `POSTMARK_CI_RECIPIENT`.
|
76
|
+
The [integration tests](https://github.com/ActiveCampaign/postmark-gem/tree/main/spec/integration) currently use a real test email address, configured via `POSTMARK_CI_RECIPIENT`.
|
77
77
|
|
78
78
|
## Copyright
|
79
79
|
|
80
|
-
Copyright ©
|
80
|
+
Copyright © 2023 ActiveCampaign LLC.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.25.0
|
data/gemfiles/Gemfile.legacy
CHANGED
@@ -10,7 +10,9 @@ group :test do
|
|
10
10
|
gem 'rspec-its', '~> 1.2'
|
11
11
|
gem 'fakeweb', :git => 'https://github.com/chrisk/fakeweb.git'
|
12
12
|
gem 'fakeweb-matcher'
|
13
|
+
gem 'mail', '~> 2.7.0'
|
13
14
|
gem 'mime-types', '~> 1.25.1'
|
15
|
+
gem 'mini_mime', '< 1.1.4'
|
14
16
|
gem 'activesupport', '~> 3.2.0'
|
15
17
|
gem 'i18n', '~> 0.6.0'
|
16
18
|
gem 'yajl-ruby', '~> 1.0', '< 1.4.0', :platforms => [:mingw, :mswin, :ruby]
|
@@ -145,6 +145,13 @@ module Postmark
|
|
145
145
|
batch
|
146
146
|
end
|
147
147
|
|
148
|
-
|
148
|
+
def get_data_removal_status(id)
|
149
|
+
format_response(http_client.get("data-removals/#{id}"))
|
150
|
+
end
|
149
151
|
|
152
|
+
def request_data_removal(attributes = {})
|
153
|
+
data = serialize(HashHelper.to_postmark(attributes))
|
154
|
+
format_response(http_client.post('data-removals', data))
|
155
|
+
end
|
156
|
+
end
|
150
157
|
end
|
data/lib/postmark/bounce.rb
CHANGED
@@ -3,7 +3,8 @@ require 'time'
|
|
3
3
|
module Postmark
|
4
4
|
class Bounce
|
5
5
|
|
6
|
-
attr_reader :email, :bounced_at, :type, :description, :details, :name, :id, :server_id, :tag, :message_id, :subject
|
6
|
+
attr_reader :email, :bounced_at, :type, :description, :details, :name, :id, :server_id, :tag, :message_id, :subject,
|
7
|
+
:message_stream, :content
|
7
8
|
|
8
9
|
def initialize(values = {})
|
9
10
|
values = Postmark::HashHelper.to_ruby(values)
|
@@ -20,6 +21,9 @@ module Postmark
|
|
20
21
|
@can_activate = values[:can_activate]
|
21
22
|
@message_id = values[:message_id]
|
22
23
|
@subject = values[:subject]
|
24
|
+
@server_id = values[:server_id]
|
25
|
+
@message_stream = values[:message_stream]
|
26
|
+
@content = values[:content]
|
23
27
|
end
|
24
28
|
|
25
29
|
def inactive?
|
@@ -171,12 +171,12 @@ module Mail
|
|
171
171
|
|
172
172
|
def export_native_attachments
|
173
173
|
attachments.map do |attachment|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
174
|
+
{
|
175
|
+
"Name" => attachment.filename,
|
176
|
+
"Content" => pack_attachment_data(attachment.body.decoded),
|
177
|
+
"ContentType" => attachment.content_type,
|
178
|
+
"ContentID" => attachment.inline? ? attachment.url : nil
|
179
|
+
}.delete_if { |_k, v| v.nil? }
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
data/lib/postmark/version.rb
CHANGED
data/postmark.gemspec
CHANGED
@@ -105,4 +105,20 @@ describe 'Account API client usage' do
|
|
105
105
|
# delete
|
106
106
|
expect { subject.delete_server(new_server[:id]) }.not_to raise_error
|
107
107
|
end
|
108
|
+
|
109
|
+
it 'manages data removals' do
|
110
|
+
# create
|
111
|
+
data_removal_status = subject.request_data_removal(
|
112
|
+
'requested_by' => 'sender@postmarkapp.com',
|
113
|
+
'requested_for' => 'test@example.com',
|
114
|
+
'notify_when_completed' => false
|
115
|
+
)
|
116
|
+
|
117
|
+
expect(data_removal_status[:status]).to eq('Pending')
|
118
|
+
|
119
|
+
# get
|
120
|
+
fetched_data_removal_status = subject.get_data_removal_status(data_removal_status[:id])
|
121
|
+
|
122
|
+
expect(fetched_data_removal_status[:id]).to eq(data_removal_status[:id])
|
123
|
+
end
|
108
124
|
end
|
@@ -728,5 +728,46 @@ describe Postmark::AccountApiClient do
|
|
728
728
|
end
|
729
729
|
end
|
730
730
|
|
731
|
+
describe '#get_data_removal_status' do
|
732
|
+
let(:response) {
|
733
|
+
{
|
734
|
+
"ID" => 42,
|
735
|
+
"Status" => "Done"
|
736
|
+
}
|
737
|
+
}
|
738
|
+
|
739
|
+
it 'performs a GET request to /data-removals/:id endpoint' do
|
740
|
+
allow(subject.http_client).to receive(:get).
|
741
|
+
with('data-removals/42').and_return(response)
|
742
|
+
subject.get_data_removal_status(42)
|
743
|
+
end
|
744
|
+
|
745
|
+
it 'formats the keys of returned response' do
|
746
|
+
allow(subject.http_client).to receive(:get).and_return(response)
|
747
|
+
keys = subject.get_data_removal_status(42).keys
|
748
|
+
expect(keys.all? { |k| k.is_a?(Symbol) }).to be true
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
752
|
+
describe '#request_data_removal' do
|
753
|
+
let(:response) {
|
754
|
+
{
|
755
|
+
"ID" => 42,
|
756
|
+
"Status" => "Done"
|
757
|
+
}
|
758
|
+
}
|
759
|
+
|
760
|
+
it 'performs a POST request to /data-removals endpoint' do
|
761
|
+
allow(subject.http_client).to receive(:post).
|
762
|
+
with('data-removals', an_instance_of(String)).and_return(response)
|
763
|
+
subject.request_data_removal(:foo => 'bar')
|
764
|
+
end
|
765
|
+
|
766
|
+
it 'formats the keys of returned response' do
|
767
|
+
allow(subject.http_client).to receive(:post).and_return(response)
|
768
|
+
keys = subject.request_data_removal(:foo => 'bar').keys
|
769
|
+
expect(keys.all? { |k| k.is_a?(Symbol) }).to be true
|
770
|
+
end
|
771
|
+
end
|
731
772
|
end
|
732
773
|
end
|
@@ -12,6 +12,10 @@ describe Postmark::Bounce do
|
|
12
12
|
:inactive => false,
|
13
13
|
:can_activate => true,
|
14
14
|
:id => 42,
|
15
|
+
:server_id => 12345,
|
16
|
+
:tag => "TEST_TAG",
|
17
|
+
:message_stream => "my-message-stream",
|
18
|
+
:content => "THE CONTENT",
|
15
19
|
:subject => "Hello from our app!"} }
|
16
20
|
let(:bounce_data_postmark) { Postmark::HashHelper.to_postmark(bounce_data) }
|
17
21
|
let(:bounces_data) { [bounce_data, bounce_data, bounce_data] }
|
@@ -31,6 +35,8 @@ describe Postmark::Bounce do
|
|
31
35
|
it { expect(subject).to respond_to(:tag) }
|
32
36
|
it { expect(subject).to respond_to(:message_id) }
|
33
37
|
it { expect(subject).to respond_to(:subject) }
|
38
|
+
it { expect(subject).to respond_to(:message_stream) }
|
39
|
+
it { expect(subject).to respond_to(:content) }
|
34
40
|
end
|
35
41
|
|
36
42
|
context "given a bounce created from bounce_data" do
|
@@ -55,6 +61,10 @@ describe Postmark::Bounce do
|
|
55
61
|
its(:bounced_at) { is_expected.to eq Time.parse(bounce_data[:bounced_at]) }
|
56
62
|
its(:id) { is_expected.to eq bounce_data[:id] }
|
57
63
|
its(:subject) { is_expected.to eq bounce_data[:subject] }
|
64
|
+
its(:message_stream) { is_expected.to eq bounce_data[:message_stream] }
|
65
|
+
its(:server_id) { is_expected.to eq bounce_data[:server_id] }
|
66
|
+
its(:tag) { is_expected.to eq bounce_data[:tag] }
|
67
|
+
its(:content) { is_expected.to eq bounce_data[:content] }
|
58
68
|
|
59
69
|
end
|
60
70
|
|
@@ -118,8 +118,8 @@ describe Postmark::MailMessageConverter do
|
|
118
118
|
from "sheldon@bigbangtheory.com"
|
119
119
|
to "lenard@bigbangtheory.com"
|
120
120
|
subject "Hello!"
|
121
|
-
body "Hello Sheldon!"
|
122
121
|
add_file empty_gif_path
|
122
|
+
body "Hello Sheldon!"
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -219,7 +219,7 @@ describe Postmark::MailMessageConverter do
|
|
219
219
|
"Subject" => "Hello!",
|
220
220
|
"Attachments" => [{"Name" => "empty.gif",
|
221
221
|
"Content" => encoded_empty_gif_data,
|
222
|
-
"ContentType" => "image/gif"}],
|
222
|
+
"ContentType" => "image/gif; filename=empty.gif"}],
|
223
223
|
"TextBody" => "Hello Sheldon!",
|
224
224
|
"To" => "lenard@bigbangtheory.com"})
|
225
225
|
end
|
@@ -183,7 +183,7 @@ describe Mail::Message do
|
|
183
183
|
let(:exported_data) {
|
184
184
|
{'Name' => 'face.jpeg',
|
185
185
|
'Content' => "YmluYXJ5ZGF0YWhlcmU=\n",
|
186
|
-
'ContentType' => 'image/jpeg'}
|
186
|
+
'ContentType' => 'image/jpeg; filename=face.jpeg'}
|
187
187
|
}
|
188
188
|
|
189
189
|
context 'given a regular attachment' 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.
|
4
|
+
version: 1.25.0
|
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: 2023-
|
16
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: json
|
@@ -33,16 +33,16 @@ dependencies:
|
|
33
33
|
name: mail
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
|
-
- - "
|
36
|
+
- - ">="
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: '0'
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- - "
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rake
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: 1.3.7
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.4.10
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Official Postmark API wrapper.
|