class Tinybucket::Api::CommitsApi

Commits Api client

@!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

repo_owner[RW]
repo_slug[RW]

Public Instance Methods

approve(revision, options = {}) click to toggle source

Send 'POST a commit approval' request @see developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/approve#post

POST a commit approval request

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

# File lib/tinybucket/api/commits_api.rb, line 57
def approve(revision, options = {})
  result = post_path(path_to_approve(revision), options)
  (result['approved'] == true)
rescue Tinybucket::Error::Conflict => e
  logger.debug 'Already approved: ' + e.inspect
  true
end
branch(name, options = {}) click to toggle source

Send 'GET commits for a branch' request

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

GET an individual commit

@param name [String] The branch name or a SHA1 value for the commit. @param options [Hash] @return [Tinybucket::Model::Commit]

# File lib/tinybucket/api/commits_api.rb, line 88
def branch(name, options = {})
  get_path(
    path_to_branch(name),
    options,
    get_parser(:collection, Tinybucket::Model::Commit)
  )
end
find(revision, options = {}) click to toggle source

Send 'GET an individual commit' request

@see developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits/%7Brevision%7D#get

GET an individual commit

@param revision [String] A SHA1 value for the commit. @param options [Hash] @return [Tinybucket::Model::Commit]

# File lib/tinybucket/api/commits_api.rb, line 42
def find(revision, options = {})
  get_path(
    path_to_find(revision),
    options,
    get_parser(:object, Tinybucket::Model::Commit)
  )
end
list(options = {}) click to toggle source

Send 'GET a commits list for a repository' request

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

GET a commits list for a repository

@note This method does not support 'compare commits across branches'

API call, yet.

@param options [Hash] @return [Tinybucket::Model::Page]

# File lib/tinybucket/api/commits_api.rb, line 26
def list(options = {})
  get_path(
    path_to_list,
    options,
    get_parser(:collection, Tinybucket::Model::Commit)
  )
end
unapprove(revision, options = {}) click to toggle source

Send 'DELETE a commit approval' request @see developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/approve#delete

DELETE a commit approval (unapprove the commit)

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

# File lib/tinybucket/api/commits_api.rb, line 72
def unapprove(revision, options = {})
  delete_path(path_to_approve(revision), options)
  true
rescue Tinybucket::Error::NotFound => e
  logger.debug 'Already unapproved: ' + e.inspect
  true
end