Skip to content

Commit

Permalink
webhooks endpoints added
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalosh committed Nov 6, 2019
1 parent f4938b4 commit 9e5ff97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
27 changes: 26 additions & 1 deletion lib/postmark/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,32 @@ def get_stats_counts(stat, options = {})
response
end

def get_webhooks(options = {})
options = HashHelper.to_postmark(options)
_, batch = load_batch('webhooks', 'Webhooks', options)
batch
end

def get_webhook(id)
format_response http_client.get("webhooks/#{id}")
end

def create_webhook(attributes = {})
data = serialize(HashHelper.to_postmark(attributes))

format_response http_client.post('webhooks', data)
end

def update_webhook(id, attributes = {})
data = serialize(HashHelper.to_postmark(attributes))

format_response http_client.put("webhooks/#{id}", data)
end

def delete_webhook(id)
format_response http_client.delete("webhooks/#{id}")
end

protected

def in_batches(messages)
Expand Down Expand Up @@ -339,6 +365,5 @@ def extract_messages_path_and_params(options = {})
path = options.delete(:inbound) ? 'messages/inbound' : 'messages/outbound'
[path, messages_key, options]
end

end
end
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.18.0'
VERSION = '1.19.0'
end

0 comments on commit 9e5ff97

Please sign in to comment.