Class: EasyPost::Services::Webhook
- Defined in:
- lib/easypost/services/webhook.rb
Constant Summary collapse
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Retrieve a list of Webhooks.
-
#create(params = {}) ⇒ Object
Create a Webhook.
-
#delete(id) ⇒ Object
Delete a Webhook.
-
#retrieve(id) ⇒ Object
Retrieve a Webhook.
-
#update(id, params = {}) ⇒ Object
Update a Webhook.
Methods inherited from Service
Constructor Details
This class inherits a constructor from EasyPost::Services::Service
Instance Method Details
#all(params = {}) ⇒ Object
Retrieve a list of Webhooks
18 19 20 |
# File 'lib/easypost/services/webhook.rb', line 18 def all(params = {}) @client.make_request(:get, 'webhooks', MODEL_CLASS, params) end |
#create(params = {}) ⇒ Object
Create a Webhook.
7 8 9 10 |
# File 'lib/easypost/services/webhook.rb', line 7 def create(params = {}) wrapped_params = { webhook: params } @client.make_request(:post, 'webhooks', MODEL_CLASS, wrapped_params) end |
#delete(id) ⇒ Object
Delete a Webhook.
28 29 30 31 32 33 |
# File 'lib/easypost/services/webhook.rb', line 28 def delete(id) @client.make_request(:delete, "webhooks/#{id}") # Return true if succeeds, an error will be thrown if it fails true end |
#retrieve(id) ⇒ Object
Retrieve a Webhook
13 14 15 |
# File 'lib/easypost/services/webhook.rb', line 13 def retrieve(id) @client.make_request(:get, "webhooks/#{id}", MODEL_CLASS) end |
#update(id, params = {}) ⇒ Object
Update a Webhook.
23 24 25 |
# File 'lib/easypost/services/webhook.rb', line 23 def update(id, params = {}) @client.make_request(:patch, "webhooks/#{id}", MODEL_CLASS, params) end |