From c16f8b4483757c1d3521dc78c3d26ba84687b0e9 Mon Sep 17 00:00:00 2001 From: Manuel Frigerio Date: Mon, 16 Nov 2020 15:19:30 +0000 Subject: [PATCH 1/3] Created spec --- spec/convertkit/client/webhook_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/convertkit/client/webhook_spec.rb b/spec/convertkit/client/webhook_spec.rb index 564ae00..8715b08 100644 --- a/spec/convertkit/client/webhook_spec.rb +++ b/spec/convertkit/client/webhook_spec.rb @@ -16,6 +16,14 @@ class Client @rule_id = 1175937 end + describe "#subscribers" do + it "sends the right request" do + r = @client.webhooks + expect(r.success?).to be_truthy + expect(r.body).to_not eql({"error"=>"Authorization Failed", "message"=>"API Key not present"}) + end + end + describe "#create_webhook" do it "creates a webhook" do url = "https://example.com/#{SecureRandom.hex}" From ff1b6c853c64638a3cf14cc737d717856bf03906 Mon Sep 17 00:00:00 2001 From: Manuel Frigerio Date: Mon, 16 Nov 2020 15:19:53 +0000 Subject: [PATCH 2/3] added #webhooks method to retrieve all webhooks --- lib/convertkit/client/webhooks.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/convertkit/client/webhooks.rb b/lib/convertkit/client/webhooks.rb index e0e962b..e2d6b5a 100644 --- a/lib/convertkit/client/webhooks.rb +++ b/lib/convertkit/client/webhooks.rb @@ -1,6 +1,10 @@ module Convertkit class Client module Webhooks + def webhooks + connection.get("automations/hooks/").body + end + def create_webhook(url, events) response = connection.post("automations/hooks") do |f| f.params['target_url'] = url From c0425f4c3b92950b126e6197fc6d27b839c31f0d Mon Sep 17 00:00:00 2001 From: Manuel Frigerio Date: Mon, 16 Nov 2020 15:23:49 +0000 Subject: [PATCH 3/3] Updated gem version --- lib/convertkit/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/convertkit/version.rb b/lib/convertkit/version.rb index 9f430ad..48d0019 100644 --- a/lib/convertkit/version.rb +++ b/lib/convertkit/version.rb @@ -1,3 +1,3 @@ module Convertkit - VERSION = "0.0.6" + VERSION = "1.0.0" end \ No newline at end of file