Sha256: 9f09ab58db36ce344dffa3d0444afa9b712d40cfee704dae674a94f9df3ad3e1

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

# encoding: utf-8

module BitBucket
  class Client::Repos::PullRequests::Comments < API
    @version = '2.0'

    # List comments on a pull request
    #
    # = Examples
    #  bitbucket = BitBucket.new
    #  bitbucket.repos.pull_requests.comments.all 'user-name', 'repo-name', 'pull-request-id'
    #
    def list(*args)
      arguments(args, required: [:user, :repo, :pull_request_id])
      user            = arguments.user
      repo            = arguments.repo
      pull_request_id = arguments.pull_request_id

      response = get_request("/repositories/#{user}/#{repo.downcase}/pullrequests/#{pull_request_id}/comments")
      return response unless block_given?
      response.each { |el| yield el }
    end
    alias :all :list

    # Gets a single comment
    #
    # = Examples
    #  @bitbucket = BitBucket.new
    #  @bitbucket.repos.pull_requests.comments.get 'user-name', 'repo-name', 'pull-request-id')
    #
    def get(*args)
      arguments(args, required: [:user, :repo, :pull_request_id, :comment_id])
      user            = arguments.user
      repo            = arguments.repo
      pull_request_id = arguments.pull_request_id
      comment_id      = arguments.comment_id

      get_request("/repositories/#{user}/#{repo.downcase}/pullrequests/#{pull_request_id}/comments/#{comment_id}")
    end
    alias :find :get
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
codenamev_bitbucket_api-0.4.1 lib/bitbucket_rest_api/client/repos/pull_requests/comments.rb
codenamev_bitbucket_api-0.4.0 lib/bitbucket_rest_api/client/repos/pull_requests/comments.rb
reenhanced_bitbucket_api-0.3.2 lib/bitbucket_rest_api/client/repos/pull_requests/comments.rb
reenhanced_bitbucket_api-0.3.1 lib/bitbucket_rest_api/client/repos/pull_requests/comments.rb