module Metova::Webhookable
Public Instance Methods
create_hook()
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 22 def create_hook Metova::WebhookJob.perform_later webhook_event('create'), self.webhook_serialize end
destroy_hook()
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 30 def destroy_hook Metova::WebhookJob.perform_later webhook_event('destroy'), self.webhook_serialize end
hook_name()
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 14 def hook_name self.class.to_s.underscore end
namespace()
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 10 def namespace '' end
update_hook()
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 26 def update_hook Metova::WebhookJob.perform_later webhook_event('update'), self.webhook_serialize end
webhook_event(event)
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 18 def webhook_event(event) [namespace, hook_name, event].reject(&:empty?).join(':') end
webhook_serialize()
click to toggle source
# File lib/metova/webhooks/models/webhookable.rb, line 34 def webhook_serialize self.to_json end