gitlab-org--gitlab-foss/app/models/hooks/web_hook.rb

30 lines
920 B
Ruby
Raw Normal View History

class WebHook < ActiveRecord::Base
include Sortable
default_value_for :push_events, true
default_value_for :issues_events, false
default_value_for :confidential_issues_events, false
default_value_for :note_events, false
default_value_for :merge_requests_events, false
default_value_for :tag_push_events, false
default_value_for :job_events, false
default_value_for :pipeline_events, false
2017-05-02 22:36:13 -04:00
default_value_for :repository_update_events, false
2015-09-15 09:19:32 -04:00
default_value_for :enable_ssl_verification, true
has_many :web_hook_logs, dependent: :destroy
2016-04-18 20:53:41 -04:00
scope :push_hooks, -> { where(push_events: true) }
scope :tag_push_hooks, -> { where(tag_push_events: true) }
2015-12-01 18:45:36 -05:00
validates :url, presence: true, url: true
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