Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit ca5093d

Browse files
oiuzikovsfroehler
authored andcommitted
Add delete operation to the webhook resource (#22)
1 parent 29ef40e commit ca5093d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Add attribute ```metadata``` to class ```Shipcloud::Shipment``` in order to transmit JSON data (#16).
44
- Add resource pickup_request in order to submit pickup request to shipcloud
55
- Add attribute ```pickup_address``` to class ```Shipcloud::PickupRequest``` to submit an alternative address for pickup request to shipcloud
6+
- Add ```delete``` operation for ```webhook``` resource
67
- Add attribute ```deactivated``` to class ```Shipcloud::Webhook```
78
- Add ```affiliate_id``` to ```Shipcloud::Configuration``` and submit it (or a default affiliate id) via API headers to shipcloud
89
- Add class ```Shipcloud::Tracker``` with create, find, and index operations

lib/shipcloud/webhook.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Shipcloud
22
class Webhook < Base
33
include Shipcloud::Operations::All
4+
include Shipcloud::Operations::Delete
45

56
attr_reader :url, :event_types, :deactivated
67

spec/shipcloud/webhooks_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
end
5353
end
5454

55+
describe ".delete" do
56+
it "makes a DELETE request using the correct API endpoint" do
57+
expect(Shipcloud).to receive(:request).
58+
with(:delete, "webhooks/123", {}, api_key: nil).
59+
and_return(true)
60+
Shipcloud::Webhook.delete("123")
61+
end
62+
end
63+
5564
describe ".deactivated" do
5665
let(:id) { "123" }
5766

0 commit comments

Comments
 (0)