summaryrefslogtreecommitdiff
path: root/lib/gitlab/github_import/hook_formatter.rb
blob: db1fabaa18af50ed0f1d241ac8395361e7d21cc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Gitlab
  module GithubImport
    class HookFormatter
      EVENTS = %w[* create delete pull_request push].freeze

      attr_reader :raw

      delegate :id, :name, :active, to: :raw

      def initialize(raw)
        @raw = raw
      end

      def config
        raw.config.attrs
      end

      def valid?
        (EVENTS & raw.events).any? && active
      end
    end
  end
end