class Tinybucket::Api::PullRequestsApi
PullRequests Api
client
pullrequests Resource
@!attribute [rw] repo_owner
@return [String] repository owner name.
@!attribute [rw] repo_slug
@return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
Attributes
Public Instance Methods
Send 'POST a pull request approval' request
@note This method return true if this pull request already approved.
@param pr_id [String] The pull request identifier @param options [Hash] @return [true, false]
# File lib/tinybucket/api/pull_requests_api.rb, line 86 def approve(pr_id, options = {}) result = post_path(path_to_approve(pr_id), options) (result['approved'] == true) rescue Tinybucket::Error::Conflict => e logger.debug 'Already approved: ' + e.inspect true end
Send 'GET the commits for a pull request' request
@param pr_id [String] The pull request identifier @param options [Hash] @return [Tinybucket::Model::PullRequest]
# File lib/tinybucket/api/pull_requests_api.rb, line 71 def commits(pr_id, options = {}) get_path( path_to_commits(pr_id), options, get_parser(:collection, Tinybucket::Model::Commit) ) end
Send 'POST a specific pull request' request
@param attrs [Hash] @return [true]
# File lib/tinybucket/api/pull_requests_api.rb, line 35 def create(attrs) post_path( path_to_create, attrs, get_parser(:object, Tinybucket::Model::PullRequest) ) end
Send 'Decline or reject a pull request' request
@param pr_id [String] The pull request identifier @param options [Hash] @return [true, false]
# File lib/tinybucket/api/pull_requests_api.rb, line 114 def decline(pr_id, options = {}) result = post_path(path_to_decline(pr_id), options) (result['state'] == 'DECLINED') end
Send 'GET the diff for a pull request' request
@param pr_id [String] The pull request identifier @param options [Hash] @return [String] diff as raw text.
# File lib/tinybucket/api/pull_requests_api.rb, line 134 def diff(pr_id, options = {}) get_path(path_to_diff(pr_id), options) end
Send 'GET a specific pull request' request
@param pr_id [String] The pull request identifier @param options [Hash] @return [Tinybucket::Model::PullRequest]
# File lib/tinybucket/api/pull_requests_api.rb, line 58 def find(pr_id, options = {}) get_path( path_to_find(pr_id), options, get_parser(:object, Tinybucket::Model::PullRequest) ) end
Send 'GET a list of open pull requests' request
@param options [Hash] @return [Tinybucket::Model::Page]
# File lib/tinybucket/api/pull_requests_api.rb, line 23 def list(options = {}) get_path( path_to_list, options, get_parser(:collection, Tinybucket::Model::PullRequest) ) end
Send 'Accept and merge a pull request' request
@param pr_id [String] The pull request identifier @param options [Hash] @return [true, false]
# File lib/tinybucket/api/pull_requests_api.rb, line 124 def merge(pr_id, options = {}) result = post_path(path_to_merge(pr_id), options) (result['state'] == 'MERGED') end
Send 'DELETE a pull request approval' request
@note This method return true if this pull request is not approved yet.
@param pr_id [String] The pull request identifier @param options [Hash] @return [true]
# File lib/tinybucket/api/pull_requests_api.rb, line 101 def unapprove(pr_id, options = {}) delete_path(path_to_approve(pr_id), options) true rescue Tinybucket::Error::NotFound => e logger.debug 'Already unapproved: ' + e.inspect true end
Send 'PUT a specific pull request' request
@param pr_id [String] The pull request identifier @param options [Hash] @return [true]
# File lib/tinybucket/api/pull_requests_api.rb, line 48 def update(pr_id, options = {}) put_path(path_to_update(pr_id), options) true end