diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-13 15:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-13 15:10:03 +0300 |
commit | 75ee59f7a108cf0c57e1e66e3ef5e439bae24fcd (patch) | |
tree | b2f1ec89e16c6b27041f608c9fb12b7586e5ce94 /lib/gitlab/static_site_editor | |
parent | e79918ce90dc31527be1ef0140a99cfe450d931e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/static_site_editor')
-rw-r--r-- | lib/gitlab/static_site_editor/config.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/gitlab/static_site_editor/config.rb b/lib/gitlab/static_site_editor/config.rb new file mode 100644 index 00000000000..4bc0fc95abd --- /dev/null +++ b/lib/gitlab/static_site_editor/config.rb @@ -0,0 +1,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 |