postmark 1.21.4 → 1.21.5

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: 27b284da8c78da623e294bfea463e876cf18e370d395b681548af71a0071afe8
4
- data.tar.gz: f12aba5cb688c265455578d011d6f917d405dac949003d2286fec6949c79367d
3
+ metadata.gz: 5f37af7becb4542a52b09dac6ddbf4f8dd9a0e8865f58c09d09d589a4df99d52
4
+ data.tar.gz: b1f0853ddb0d5df6ed028b73f838cc23ed4438955280c3374b94bb4d4dd1d002
5
5
  SHA512:
6
- metadata.gz: d8881a25fa5bec51bdb8b2db632f3a5a3d1aa1457dd13df1d6e274758b8c4da992cc74ad2b512e4dc771a23c3fafba197bc5c9a979302032114fc5486f49a98d
7
- data.tar.gz: e9be7104643c2b9e9ec7fff821af17675afccb51dfe717e72cd1975e6cdf713f322302a18e3df16943e53976e11bb0d80adb5e685faaeff98ff9ec4d1dafaa2c
6
+ metadata.gz: 5fff0cb52f3fa2368e7e930b480cc020a5f7783c5b946be06b39537f4c4673c191b7861083ddadfdbed395767377ad885c8ef218f8af6801cb3d9e84fdf94826
7
+ data.tar.gz: e649bf1192c4669f22622427cf986f6b53369f0a0c1c0bf3e97b6e782b6c4400d53b2d2e06f87cf2c24d853317c601c8b72c3a607f6b23ac7142fa517c566799
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Changelog
2
2
 
3
+ == 1.21.5
4
+
5
+ * Added support for archiving/unarchiving message streams
6
+
3
7
  == 1.21.4
4
8
 
5
9
  * Fixed Postmark::ApiClient#deliver_messages_with_templates (#104)
@@ -352,6 +352,14 @@ module Postmark
352
352
  format_response(http_client.patch("message-streams/#{id}", data))
353
353
  end
354
354
 
355
+ def archive_message_stream(id)
356
+ format_response http_client.post("message-streams/#{id}/archive")
357
+ end
358
+
359
+ def unarchive_message_stream(id)
360
+ format_response http_client.post("message-streams/#{id}/unarchive")
361
+ end
362
+
355
363
  def dump_suppressions(stream_id, options = {})
356
364
  _, batch = load_batch("message-streams/#{stream_id}/suppressions/dump", 'Suppressions', options)
357
365
  batch
@@ -1,3 +1,3 @@
1
1
  module Postmark
2
- VERSION = '1.21.4'
2
+ VERSION = '1.21.5'
3
3
  end
data/postmark.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.license = 'MIT'
11
11
 
12
- s.authors = ["Petyo Ivanov", "Ilya Sabanin", "Artem Chistyakov"]
13
- s.email = "ilya@wildbit.com"
12
+ s.authors = ["Tomek Maszkowski", "Igor Balos", "Artem Chistyakov", "Nick Hammond", "Petyo Ivanov", "Ilya Sabanin"]
13
+ s.email = "tomek@wildbit.com"
14
14
  s.extra_rdoc_files = ["LICENSE", "README.md"]
15
15
  s.rdoc_options = ["--charset=UTF-8"]
16
16
 
@@ -606,10 +606,14 @@ describe Postmark::ApiClient do
606
606
  end
607
607
 
608
608
  describe "#server_info" do
609
- let(:response) {{"Name" => "Testing",
610
- "Color" => "blue",
611
- "InboundHash" => "c2425d77f74f8643e5f6237438086c81",
612
- "SmtpApiActivated" => true}}
609
+ let(:response) {
610
+ {
611
+ "Name" => "Testing",
612
+ "Color" => "blue",
613
+ "InboundHash" => "c2425d77f74f8643e5f6237438086c81",
614
+ "SmtpApiActivated" => true
615
+ }
616
+ }
613
617
 
614
618
  it 'requests server info from Postmark and converts it to ruby format' do
615
619
  expect(http_client).to receive(:get).with('server') {response}
@@ -618,10 +622,14 @@ describe Postmark::ApiClient do
618
622
  end
619
623
 
620
624
  describe "#update_server_info" do
621
- let(:response) {{"Name" => "Testing",
622
- "Color" => "blue",
623
- "InboundHash" => "c2425d77f74f8643e5f6237438086c81",
624
- "SmtpApiActivated" => false}}
625
+ let(:response) {
626
+ {
627
+ "Name" => "Testing",
628
+ "Color" => "blue",
629
+ "InboundHash" => "c2425d77f74f8643e5f6237438086c81",
630
+ "SmtpApiActivated" => false
631
+ }
632
+ }
625
633
  let(:update) {{:smtp_api_activated => false}}
626
634
 
627
635
  it 'updates server info in Postmark and converts it to ruby format' do
@@ -1148,6 +1156,62 @@ describe Postmark::ApiClient do
1148
1156
  }
1149
1157
  end
1150
1158
 
1159
+ describe '#archive_message_stream' do
1160
+ subject { api_client.archive_message_stream(stream_id) }
1161
+
1162
+ let(:stream_id) { 'my-stream'}
1163
+ let(:server_id) { 123 }
1164
+ let(:purge_date) { '2030-08-30T12:30:00.00-04:00' }
1165
+ let(:api_endpoint) { "message-streams/#{stream_id}/archive" }
1166
+ let(:api_response) {{ 'ID' => stream_id, 'ServerID' => server_id, 'ExpectedPurgeDate' => purge_date }}
1167
+
1168
+ before do
1169
+ allow(http_client).to receive(:post).with(api_endpoint) { api_response }
1170
+ end
1171
+
1172
+ it 'calls the API endpoint' do
1173
+ expect(http_client).to receive(:post).with(api_endpoint)
1174
+ subject
1175
+ end
1176
+
1177
+ it 'transforms the API response' do
1178
+ expect(subject).to eq({ :id => stream_id, :server_id => server_id, :expected_purge_date => purge_date })
1179
+ end
1180
+ end
1181
+
1182
+ describe '#unarchive_message_stream' do
1183
+ subject { api_client.unarchive_message_stream(stream_id) }
1184
+
1185
+ let(:stream_id) { 'my-stream'}
1186
+ let(:server_id) { 123 }
1187
+ let(:api_endpoint) { "message-streams/#{stream_id}/unarchive" }
1188
+ let(:api_response) {
1189
+ { 'ID' => stream_id, 'ServerID' => server_id, 'Name' => 'My Stream',
1190
+ 'Description' => 'My test stream.', 'MessageStreamType' => 'Transactional',
1191
+ 'CreatedAt' => '2030-08-30T12:30:00.00-04:00', 'UpdatedAt' => '2030-09-30T12:30:00.00-04:00',
1192
+ 'ArchivedAt'=> nil, 'ExpectedPurgeDate' => nil,
1193
+ 'SubscriptionManagementConfiguration' => { 'UnsubscribeHandlingType' => 'None' } }
1194
+ }
1195
+
1196
+ before do
1197
+ allow(http_client).to receive(:post).with(api_endpoint) { api_response }
1198
+ end
1199
+
1200
+ it 'calls the API endpoint' do
1201
+ expect(http_client).to receive(:post).with(api_endpoint)
1202
+ subject
1203
+ end
1204
+
1205
+ it 'transforms the API response' do
1206
+ expect(subject).to eq({ :id => stream_id, :server_id => server_id, :name => 'My Stream',
1207
+ :description => 'My test stream.', :message_stream_type => 'Transactional',
1208
+ :created_at => '2030-08-30T12:30:00.00-04:00',
1209
+ :updated_at => '2030-09-30T12:30:00.00-04:00',
1210
+ :archived_at => nil , :expected_purge_date => nil ,
1211
+ :subscription_management_configuration => { 'UnsubscribeHandlingType' => 'None' }})
1212
+ end
1213
+ end
1214
+
1151
1215
  describe '#create_suppressions' do
1152
1216
  let(:email_addresses) { nil }
1153
1217
  let(:message_stream_id) { 'outbound' }
metadata CHANGED
@@ -1,16 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.4
4
+ version: 1.21.5
5
5
  platform: ruby
6
6
  authors:
7
+ - Tomek Maszkowski
8
+ - Igor Balos
9
+ - Artem Chistyakov
10
+ - Nick Hammond
7
11
  - Petyo Ivanov
8
12
  - Ilya Sabanin
9
- - Artem Chistyakov
10
13
  autorequire:
11
14
  bindir: bin
12
15
  cert_chain: []
13
- date: 2021-06-14 00:00:00.000000000 Z
16
+ date: 2021-07-22 00:00:00.000000000 Z
14
17
  dependencies:
15
18
  - !ruby/object:Gem::Dependency
16
19
  name: json
@@ -56,7 +59,7 @@ dependencies:
56
59
  version: '0'
57
60
  description: Use this gem to send emails through Postmark HTTP API and retrieve info
58
61
  about bounces.
59
- email: ilya@wildbit.com
62
+ email: tomek@wildbit.com
60
63
  executables: []
61
64
  extensions: []
62
65
  extra_rdoc_files:
@@ -147,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
150
  - !ruby/object:Gem::Version
148
151
  version: 1.3.7
149
152
  requirements: []
150
- rubygems_version: 3.0.8
153
+ rubygems_version: 3.2.3
151
154
  signing_key:
152
155
  specification_version: 4
153
156
  summary: Official Postmark API wrapper.