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

branch_entity.rb « serializers « jira_connect « atlassian « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c663575b7a820b6c557fd1ee1ad3a75fcb0d79dd (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
# frozen_string_literal: true

module Atlassian
  module JiraConnect
    module Serializers
      class BranchEntity < BaseEntity
        expose :id do |branch|
          Digest::SHA256.hexdigest(branch.name)
        end
        expose :issueKeys do |branch|
          JiraIssueKeyExtractor.new(branch.name).issue_keys
        end
        expose :name
        expose :lastCommit, using: JiraConnect::Serializers::CommitEntity do |branch, options|
          options[:project].commit(branch.dereferenced_target)
        end

        expose :url do |branch, options|
          project_commits_url(options[:project], branch.name)
        end
        expose :createPullRequestUrl do |branch, options|
          project_new_merge_request_url(
            options[:project],
            merge_request: {
              source_branch: branch.name
            }
          )
        end
      end
    end
  end
end