Class: PayPal::SDK::REST::DataTypes::Webhook
Constant Summary
Core::API::DataTypes::Base::ContentKey, Core::API::DataTypes::Base::HashOptions
Instance Attribute Summary
Attributes inherited from Base
#error, #header, #request_id
Class Method Summary
collapse
Instance Method Summary
collapse
#api, api, #error=, included
Methods included from SetAPI
#client_id=, #client_secret=, #set_config, #token=
Methods inherited from Base
#http_header, #merge!, #raise_error!, raise_on_api_error, #success?
add_attribute, add_member, array_of, #convert_array, #convert_object, define_alias_methods, #hash_key, #initialize, #member_names, members, #members, #merge!, object_of, #set, #skip_value?, snakecase, #to_hash, #value_to_hash
#log_event, #logger, logger, logger=
Class Method Details
.all(options = {}) ⇒ Object
1670
1671
1672
1673
|
# 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) ⇒ Object
1658
1659
1660
1661
1662
|
# 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) ⇒ Object
1664
1665
1666
1667
1668
|
# 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 ⇒ Object
1623
1624
1625
1626
1627
1628
|
# 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) ⇒ Object
1675
1676
1677
1678
1679
1680
|
# 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
|
Instance Method Details
#create ⇒ Object
1632
1633
1634
1635
1636
1637
|
# File 'lib/paypal-sdk/rest/data_types.rb', line 1632
def create()
path = "v1/notifications/webhooks"
response = api.post(path, self.to_hash, )
self.merge!(response)
Webhook.new(response)
end
|
#delete ⇒ Object
1648
1649
1650
1651
1652
1653
|
# 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) ⇒ Object
1639
1640
1641
1642
1643
1644
1645
1646
|
# 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, )
self.merge!(response)
success?
end
|