2011-12-14 11:38:52 -05:00
|
|
|
class WebHook < ActiveRecord::Base
|
2015-02-05 17:20:55 -05:00
|
|
|
include Sortable
|
2011-12-14 11:38:52 -05:00
|
|
|
|
2017-06-08 11:16:27 -04:00
|
|
|
has_many :web_hook_logs, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
2017-04-27 06:08:57 -04:00
|
|
|
|
2015-12-01 18:45:36 -05:00
|
|
|
validates :url, presence: true, url: true
|
2011-12-14 11:38:52 -05:00
|
|
|
|
2015-01-23 19:10:43 -05:00
|
|
|
def execute(data, hook_name)
|
2017-04-27 06:08:57 -04:00
|
|
|
WebHookService.new(self, data, hook_name).execute
|
2011-12-14 11:38:52 -05:00
|
|
|
end
|
2013-01-24 15:15:24 -05:00
|
|
|
|
2015-01-23 19:10:43 -05:00
|
|
|
def async_execute(data, hook_name)
|
2017-04-27 06:08:57 -04:00
|
|
|
WebHookService.new(self, data, hook_name).async_execute
|
2016-04-27 03:24:49 -04:00
|
|
|
end
|
2011-12-14 11:38:52 -05:00
|
|
|
end
|