debian-mirror-gitlab/app/models/hooks/web_hook.rb
2018-03-17 18:26:18 +05:30

16 lines
437 B
Ruby

class WebHook < ActiveRecord::Base
include Sortable
has_many :web_hook_logs, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
validates :url, presence: true, url: true
validates :token, format: { without: /\n/ }
def execute(data, hook_name)
WebHookService.new(self, data, hook_name).execute
end
def async_execute(data, hook_name)
WebHookService.new(self, data, hook_name).async_execute
end
end