Skip to content

Commit

Permalink
Remove deprecated trigger update endpoint references, update to v1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Hammond authored and tomek-ac committed Mar 12, 2020
1 parent 275a581 commit fe00eb8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ rvm:
- 2.1.9
- 2.2.5
- 2.3.1
- 2.5.7
- 2.6.5
- 2.7.0
matrix:
include:
- rvm: 1.8.7
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.0
1.20.0
5 changes: 0 additions & 5 deletions lib/postmark/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ def get_trigger(type, id)
format_response http_client.get("triggers/#{type}/#{id}")
end

def update_trigger(type, id, options)
data = serialize(HashHelper.to_postmark(options))
format_response http_client.put("triggers/#{type}/#{id}", data)
end

def delete_trigger(type, id)
type = Postmark::Inflector.to_postmark(type).downcase
format_response http_client.delete("triggers/#{type}/#{id}")
Expand Down
2 changes: 1 addition & 1 deletion lib/postmark/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Postmark
VERSION = '1.19.2'
VERSION = '1.20.0'
end
19 changes: 1 addition & 18 deletions spec/integration/api_client_resources_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@
}
}

context 'Triggers API' do
let(:unique_token) {rand(36 ** 32).to_s(36)}

it 'can be used to manage tag triggers via the API' do
skip("Endpoint removed")
trigger = api_client.create_trigger(:tags, :match_name => "gemtest_#{unique_token}", :track_opens => true)
api_client.update_trigger(:tags, trigger[:id], :match_name => "pre_#{trigger[:match_name]}")
updated = api_client.get_trigger(:tags, trigger[:id])

expect(updated[:id]).to eq(trigger[:id])
expect(updated[:match_name]).not_to eq(trigger[:id])
expect(api_client.triggers(:tags).map {|t| t[:id]}).to include(trigger[:id])

api_client.delete_trigger(:tags, trigger[:id])
end
end

context 'Messages API' do
def with_retries(max_retries = 20, wait_seconds = 3)
yield
Expand Down Expand Up @@ -70,4 +53,4 @@ def with_retries(max_retries = 20, wait_seconds = 3)
}.not_to raise_error
end
end
end
end
45 changes: 1 addition & 44 deletions spec/unit/postmark/api_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,22 +538,6 @@
describe '#create_trigger' do
let(:http_client) {subject.http_client}

context 'tags' do
let(:options) {{:foo => 'bar'}}
let(:response) {{'Foo' => 'Bar'}}

it 'performs a POST request to /triggers/tags with given options' do
allow(http_client).to receive(:post).with('triggers/tags',
{'Foo' => 'bar'}.to_json)
subject.create_trigger(:tags, options)
end

it 'symbolizes response keys' do
allow(http_client).to receive(:post).and_return(response)
expect(subject.create_trigger(:tags, options)).to eq(:foo => 'Bar')
end
end

context 'inbound rules' do
let(:options) {{:rule => 'example.com'}}
let(:response) {{'Rule' => 'example.com'}}
Expand Down Expand Up @@ -586,23 +570,6 @@
end
end

describe '#update_trigger' do
let(:http_client) {subject.http_client}
let(:options) {{:foo => 'bar'}}
let(:id) {42}

it 'performs a PUT request to /triggers/tags/:id' do
allow(http_client).to receive(:put).with("triggers/tags/#{id}",
{'Foo' => 'bar'}.to_json)
subject.update_trigger(:tags, id, options)
end

it 'symbolizes response keys' do
allow(http_client).to receive(:put).and_return('Foo' => 'Bar')
expect(subject.update_trigger(:tags, id, options)).to eq(:foo => 'Bar')
end
end

describe '#delete_trigger' do
let(:http_client) {subject.http_client}

Expand All @@ -619,7 +586,7 @@
expect(subject.delete_trigger(:tags, id)).to eq(:foo => 'Bar')
end
end

context 'inbound rules' do
let(:id) {42}

Expand All @@ -639,16 +606,6 @@
let(:http_client) {subject.http_client}
let(:options) {{:offset => 5}}

context 'tags' do
let(:response) {{'Tags' => [], 'TotalCount' => 0}}

it 'performs a GET request to /triggers/tags' do
allow(http_client).to receive(:get).with('triggers/tags', options) {response}
expect(subject.get_triggers(:tags, options)).to be_an(Array)
expect(subject.get_triggers(:tags, options).count).to be_zero
end
end

context 'inbound rules' do
let(:response) {{'InboundRules' => [], 'TotalCount' => 0}}

Expand Down

0 comments on commit fe00eb8

Please sign in to comment.