debian-mirror-gitlab/app/models/hooks/web_hook.rb

16 lines
391 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
class WebHook < ActiveRecord::Base
2015-04-26 12:48:37 +05:30
include Sortable
2014-09-02 18:07:02 +05:30
2017-09-10 17:25:29 +05:30
has_many :web_hook_logs, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
2014-09-02 18:07:02 +05:30
2015-12-23 02:04:40 +05:30
validates :url, presence: true, url: true
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
def execute(data, hook_name)
2017-09-10 17:25:29 +05:30
WebHookService.new(self, data, hook_name).execute
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
def async_execute(data, hook_name)
2017-09-10 17:25:29 +05:30
WebHookService.new(self, data, hook_name).async_execute
2016-06-02 11:05:42 +05:30
end
2014-09-02 18:07:02 +05:30
end