Sha256: dae1b1e2d5e456e6d74eea149f60ccb2bccdc7fdf2fb0bd5275eb65cc7332753

Contents?: true

Size: 996 Bytes

Versions: 11

Compression:

Stored size: 996 Bytes

Contents

module Pronto
  class BitbucketServer < Bitbucket
    def pull_comments(sha)
      @comment_cache["#{pull_id}/#{sha}"] ||= begin
        client.pull_comments(slug, pull_id).map do |comment|
          anchor = comment['commentAnchor']
          if anchor
            Comment.new(sha, comment['comment']['text'],
                        anchor['path'], anchor['line'])
          end
        end.compact
      end
    end

    private

    def client
      @client ||= BitbucketServerClient.new(@config.bitbucket_username,
                                            @config.bitbucket_password,
                                            @config.bitbucket_api_endpoint)
    end

    def pull
      @pull ||= if env_pull_id
                  pull_requests.find { |pr| pr.id.to_i == env_pull_id }
                elsif @repo.branch
                  pull_requests.find do |pr|
                    pr['fromRef']['displayId'] == @repo.branch
                  end
                end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pronto-0.11.3 lib/pronto/bitbucket_server.rb
pronto-0.11.2 lib/pronto/bitbucket_server.rb
pronto-0.11.1 lib/pronto/bitbucket_server.rb
pronto-0.11.0 lib/pronto/bitbucket_server.rb
pronto-0.10.0 lib/pronto/bitbucket_server.rb
pronto-0.9.5 lib/pronto/bitbucket_server.rb
pronto-0.9.4 lib/pronto/bitbucket_server.rb
pronto-0.9.3 lib/pronto/bitbucket_server.rb
pronto-0.9.2 lib/pronto/bitbucket_server.rb
pronto-0.9.1 lib/pronto/bitbucket_server.rb
pronto-0.9.0 lib/pronto/bitbucket_server.rb