class Tinybucket::Model::PullRequest

PullRequest

@see developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests

pullrequest Resource

@!attribute [rw] state

@return [String]

@!attribute [rw] description

@return [String]

@!attribute [rw] links

@return [Hash]

@!attribute [rw] title

@return [String]

@!attribute [rw] task_count

@return [Fixnum]

@!attribute [rw] comment_count

@return [Fixnum]

@!attribute [rw] close_source_branch

@return [true, false]

@!attribute [rw] destination

@return [Hash]

@!attribute [rw] reason

@return [String]

@!attribute [rw] id

@return [Fixnum]

@!attribute [rw] source

@return [Hash]

@!attribute [rw] created_on

@return [String]

@!attribute [rw] author

@return [Hash]

@!attribute [rw] updated_on

@return [String]

@!attribute [rw] merge_commit

@return [Hash]

@!attribute [rw] closed_by

@return [Hash]

@!attribute [rw] reviewers

@return [Array]

@!attribute [rw] participants

@return [Array]

@!attribute [rw] uuid

@return [NillClass]

@!attribute [rw] type

@return [String]

Public Instance Methods

activities(_options = {}) click to toggle source

Get activities on this pull requests.

# File lib/tinybucket/model/pull_request.rb, line 137
def activities(_options = {})
  raise NotImplementedError
end
approve(options = {}) click to toggle source

Give approval on this pull request.

@param options [Hash] @return [true, false]

# File lib/tinybucket/model/pull_request.rb, line 82
def approve(options = {})
  pull_request_api.approve(id, options)
end
comment(comment_id, options = {}) click to toggle source

Get the specific comment on this pull request.

@param comment_id [String] @param options [Hash] @return [Tinybucket::Model::Comment]

# File lib/tinybucket/model/pull_request.rb, line 115
def comment(comment_id, options = {})
  comments_resource.find(comment_id, options)
end
comments(options = {}) click to toggle source

Get comments on this pull request.

@param options [Hash] @return [Tinybucket::Resource::PullRequest::Comments]

# File lib/tinybucket/model/pull_request.rb, line 106
def comments(options = {})
  comments_resource(options)
end
commits(options = {}) click to toggle source

Get commits associated with this pull request.

@param options [Hash] @return [Tinybucket::Resource::PullRequest::Commits]

# File lib/tinybucket/model/pull_request.rb, line 98
def commits(options = {})
  commits_resource(options)
end
decline(options = {}) click to toggle source

Decline or reject this pull request.

@param options [Hash] @return [true,false]

# File lib/tinybucket/model/pull_request.rb, line 74
def decline(options = {})
  pull_request_api.decline(id, options)
end
diff(options = {}) click to toggle source

Get the diff for this pull request.

@param options [Hash] @return [String] diff as raw text.

# File lib/tinybucket/model/pull_request.rb, line 123
def diff(options = {})
  pull_request_api.diff(id, options)
end
merge(options = {}) click to toggle source

Accept and merge this pull request.

@param options [Hash] @return [true, false]

# File lib/tinybucket/model/pull_request.rb, line 131
def merge(options = {})
  pull_request_api.merge(id, options)
end
unapprove(options = {}) click to toggle source

Revoke approval on this pull request.

@param options [Hash] @return [true, false]

# File lib/tinybucket/model/pull_request.rb, line 90
def unapprove(options = {})
  pull_request_api.unapprove(id, options)
end
update(attrs = {}) click to toggle source

Update this pull request.

@param attrs [Hash] Attributes to be updated. Only :title, :description, :reviewers supported @return

# File lib/tinybucket/model/pull_request.rb, line 64
def update(attrs = {})
  update_attrs = [ :title, :description, :reviewers ]
  self.attributes.merge!(attrs.slice(*update_attrs))
  pull_request_api.update(id, self.attributes.slice(*update_attrs))
end

Private Instance Methods

comments_resource(options = {}) click to toggle source
# File lib/tinybucket/model/pull_request.rb, line 147
def comments_resource(options = {})
  Tinybucket::Resource::PullRequest::Comments.new(self, options)
end
commits_resource(options = {}) click to toggle source
# File lib/tinybucket/model/pull_request.rb, line 143
def commits_resource(options = {})
  Tinybucket::Resource::PullRequest::Commits.new(self, options)
end
load_model() click to toggle source
# File lib/tinybucket/model/pull_request.rb, line 157
def load_model
  pull_request_api.find(id)
end
pull_request_api() click to toggle source
# File lib/tinybucket/model/pull_request.rb, line 151
def pull_request_api
  raise ArgumentError, MISSING_REPOSITORY_KEY unless repo_keys?

  create_api('PullRequests', repo_keys)
end