Module: Epages::REST::Webhooks
- Includes:
- Utils
- Included in:
- API
- Defined in:
- lib/epages/rest/webhooks.rb
Instance Method Summary
collapse
Methods included from Utils
#epages_id, #format_date, #format_dates_options, #parse_legal_info, #parse_links, #parse_price_info, #parse_product_lowest_price, #parse_product_variations, #parse_suggestions_to_products, #parse_variation_object, #parse_variations, #perform_delete_request, #perform_delete_with_object, #perform_get_request, #perform_get_with_key_and_objects, #perform_get_with_object, #perform_get_with_objects, #perform_multipart_post_with_objects, #perform_patch_with_object, #perform_post_request, #perform_post_with_key_and_objects, #perform_post_with_object, #perform_post_with_objects, #perform_put_request, #perform_put_with_object, #perform_request, #perform_request_with_key_and_objects, #perform_request_with_object, #perform_request_with_objects, #process_thread
Instance Method Details
#activate_webhook(webhook_id) ⇒ Object
21
22
23
|
# File 'lib/epages/rest/webhooks.rb', line 21
def activate_webhook(webhook_id)
perform_post_with_object("/webhooks/#{webhook_id}", { 'active': 'true' }, Epages::Webhook)
end
|
#create_webhook(callback_url, event_type) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/epages/rest/webhooks.rb', line 13
def create_webhook(callback_url, event_type)
available_events = ["PRODUCT_CREATE", "PRODUCT_UPDATE", "PRODUCT_DELETE", "ORDER_CREATE", "ORDER_UPDATE", "ORDER_DELETE", "APP_UNINSTALL"]
perform_post_with_object("/webhooks",
{ 'callbackUrl': callback_url, 'eventType': event_type },
Epages::Webhook)
end
|
#deactivate_webhook(webhook_id) ⇒ Object
25
26
27
|
# File 'lib/epages/rest/webhooks.rb', line 25
def deactivate_webhook(webhook_id)
perform_post_with_object("/webhooks/#{webhook_id}", { 'active': 'false' }, Epages::Webhook)
end
|
#delete_webhook(webhook_id, options = {}) ⇒ Object
29
30
31
32
|
# File 'lib/epages/rest/webhooks.rb', line 29
def delete_webhook(webhook_id, options = {})
answer = perform_delete_request("/webhooks/#{webhook_id}", options)
return answer.nil? ? 'Deleted' : 'Error'
end
|
#webhook(webhook_id, options = {}) ⇒ Object
9
10
11
|
# File 'lib/epages/rest/webhooks.rb', line 9
def webhook(webhook_id, options = {})
perform_get_with_object("/webhooks/#{webhook_id}", options, Epages::Webhook)
end
|