Welcome to mirror list, hosted at ThFree Co, Russian Federation.

config.rb « static_site_editor « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4bc0fc95abd765228f0d42db77e490d0423c644a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module Gitlab
  module StaticSiteEditor
    class Config
      def initialize(repository, ref, file_path, return_url)
        @repository = repository
        @ref = ref
        @file_path = file_path
        @return_url = return_url
      end

      def payload
        {
          branch: ref,
          path: file_path,
          commit: commit.id,
          project_id: project.id,
          project: project.path,
          namespace: project.namespace.path,
          return_url: return_url
        }
      end

      private

      attr_reader :repository, :ref, :file_path, :return_url

      delegate :project, to: :repository

      def commit
        repository.commit(ref)
      end
    end
  end
end