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 +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/postmark/account_api_client.rb +6 -0
- data/lib/postmark/client.rb +4 -0
- data/lib/postmark/version.rb +1 -1
- data/spec/unit/postmark/account_api_client_spec.rb +28 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ed88f1a2900b1aab8bfddc4f0dd0a77015bdaa221bb3d964aea4f4f2192802
|
4
|
+
data.tar.gz: e0881eb66ae061731ecf5ce16335da4feb29e44af8b7c57d3705d3e6c49d9a96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327637a52ec906d22bd92036eae1ea68dd1d0ea9e8c38909297855fba5cacfc21a22384ff3801961218191306ff23fc95f2eb24d48f3a7e656c28532e652fd8d
|
7
|
+
data.tar.gz: d82c2d97f23125a664405197d275b1f2485cdaa4b506e0598faf8e11b0820bd32b9bde4613d54a2db5abc094d4a5f6520b382be75afb8b8787cc94b50403b25a
|
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
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
|
data/lib/postmark/client.rb
CHANGED
@@ -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
|
|
data/lib/postmark/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
150
|
+
rubygems_version: 2.7.8
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Official Postmark API wrapper.
|