summaryrefslogtreecommitdiff
path: root/app/models/hooks/web_hook.rb
blob: 27729deeac9e0081d990281a50258c8ef4365c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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