postmark 1.15.0 → 1.16.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1832c6626bce3fc8f5a8a6147a5a855d99f723d726ceb8c8478991dd6dad29a4
4
- data.tar.gz: e22122605081b3ab53e6f1d1ba23767c5b6f2d5932b4ac1ca69b2bf1618ed0b4
3
+ metadata.gz: 42ed88f1a2900b1aab8bfddc4f0dd0a77015bdaa221bb3d964aea4f4f2192802
4
+ data.tar.gz: e0881eb66ae061731ecf5ce16335da4feb29e44af8b7c57d3705d3e6c49d9a96
5
5
  SHA512:
6
- metadata.gz: 51dcf2d0964a2361e6679e3bf5c20225b3e9a7a30fdac96da974b8d7226ae9b8f8c67e918a6268f6f0d95169c43f608b4dc45a04192f7b07d3b7a9daff865860
7
- data.tar.gz: ddc1ddb44493d6c3bd75d6175d502407ad810dc814c03e847d61400526c4f3f478475f60f2ddb2d3a682d05ffa19c7236ad46a157936c5e128e23a34a339c75a
6
+ metadata.gz: 327637a52ec906d22bd92036eae1ea68dd1d0ea9e8c38909297855fba5cacfc21a22384ff3801961218191306ff23fc95f2eb24d48f3a7e656c28532e652fd8d
7
+ data.tar.gz: d82c2d97f23125a664405197d275b1f2485cdaa4b506e0598faf8e11b0820bd32b9bde4613d54a2db5abc094d4a5f6520b382be75afb8b8787cc94b50403b25a
@@ -1,5 +1,9 @@
1
1
  = Changelog
2
2
 
3
+ == 1.16.0
4
+
5
+ * Added support for template pushes.
6
+
3
7
  == 1.15.0
4
8
 
5
9
  * Extended Mail::Message objects with support for Postmark templates.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.15.0
1
+ 1.16.0
@@ -139,6 +139,12 @@ module Postmark
139
139
  format_response http_client.delete("servers/#{id.to_i}")
140
140
  end
141
141
 
142
+ def push_templates(attributes = {})
143
+ data = serialize(HashHelper.to_postmark(attributes))
144
+ _, batch = format_batch_response(http_client.put('templates/push', data), "Templates")
145
+ batch
146
+ end
147
+
142
148
  end
143
149
 
144
150
  end
@@ -80,6 +80,10 @@ module Postmark
80
80
  options[:offset] ||= 0
81
81
  options[:count] ||= 30
82
82
  response = http_client.get(path, options)
83
+ format_batch_response(response, name)
84
+ end
85
+
86
+ def format_batch_response(response, name)
83
87
  [response['TotalCount'], format_response(response[name])]
84
88
  end
85
89
 
@@ -1,3 +1,3 @@
1
1
  module Postmark
2
- VERSION = '1.15.0'
2
+ VERSION = '1.16.0'
3
3
  end
@@ -748,6 +748,34 @@ describe Postmark::AccountApiClient do
748
748
 
749
749
  end
750
750
 
751
+ describe '#push_templates' do
752
+ let(:response) {
753
+ {"TotalCount"=>5,
754
+ "Templates"=>
755
+ [{"Action"=>"Create", "TemplateId"=>nil, "Alias"=>"alias1", "Name"=>"Comment notification"},
756
+ {"Action"=>"Create", "TemplateId"=>nil, "Alias"=>"alias2", "Name"=>"Password reset"}]}
757
+ }
758
+
759
+ let(:request_data) {{:source_server_id => 1, :destination_server_id => 2, :perform_changes => false}}
760
+
761
+ it 'gets templates info and converts it to ruby format' do
762
+ allow(subject.http_client).to receive(:put).and_return(response)
763
+ templates = subject.push_templates({:source_server_id => 1, :destination_server_id => 2, :perform_changes => false} )
764
+
765
+ expect(templates.size).to eq(2)
766
+ expect(templates.first[:action]).to eq('Create')
767
+ expect(templates.first[:alias]).to eq('alias1')
768
+ end
769
+
770
+ it 'formats the keys of returned response' do
771
+ allow(subject.http_client).to receive(:put).and_return(response)
772
+ templates = subject.push_templates({:source_server_id => 1, :destination_server_id => 2, :perform_changes => false} )
773
+
774
+ keys = templates.map { |template| template.keys }.flatten
775
+ expect(keys.all? { |k| k.is_a?(Symbol) }).to be true
776
+ end
777
+ end
778
+
751
779
  end
752
780
 
753
781
  end
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.15.0
4
+ version: 1.16.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-01-09 00:00:00.000000000 Z
13
+ date: 2019-01-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: 1.3.7
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.7.7
150
+ rubygems_version: 2.7.8
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Official Postmark API wrapper.