class PayPal::SDK::REST::DataTypes::Webhook
Public Class Methods
all(options={})
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1670 def all(options={}) path = "v1/notifications/webhooks" WebhookList.new(api.get(path)) end
get(webhook_id)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1658 def get(webhook_id) raise ArgumentError.new("webhook_id required") if webhook_id.to_s.strip.empty? path = "v1/notifications/webhooks/#{webhook_id}" Webhook.new(api.get(path)) end
get_event_types(webhook_id)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1664 def get_event_types(webhook_id) raise ArgumentError.new("webhook_id required") if webhook_id.to_s.strip.empty? path = "v1/notifications/webhooks/#{webhook_id}/event-types" EventTypeList.new(api.get(path)) end
load_members()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1623 def self.load_members object_of :id, String object_of :url, String array_of :event_types, EventType array_of :links, Links end
simulate_event(webhook_id, url, event_type)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1675 def simulate_event(webhook_id, url, event_type) path = "v1/notifications/simulate-event" options = { :webhook_id => webhook_id, :url => url, :event_type => event_type } response = api.post(path, options) WebhookEvent.new(response) end
Public Instance Methods
create()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1632 def create() path = "v1/notifications/webhooks" response = api.post(path, self.to_hash, http_header) self.merge!(response) Webhook.new(response) end
delete()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1648 def delete() path = "v1/notifications/webhooks/#{self.id}" response = api.delete(path, {}) self.merge!(response) success? end
update(patch)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1639 def update(patch) patch = Patch.new(patch) unless patch.is_a? Patch patch_request = Array.new(1, patch.to_hash) path = "v1/notifications/webhooks/#{self.id}" response = api.patch(path, patch_request, http_header) self.merge!(response) success? end