Sha256: 65242232ca9a9ae20d8a69662e697db4f00ba020527260bee7c311c5197c1538

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

# encoding: utf-8

module BitBucket
  class Repos::Changesets < API

    REQUIRED_COMMENT_PARAMS = %w[
        body
        changeset_id
        line
        path
        position
      ].freeze

    # List changesets on a repository
    #
    # = Parameters
    # * <tt>:limit</tt> Optional integer. An integer representing how many changesets to return. You can specify a limit between 0 and 50.
    # * <tt>:start</tt> Optional string. A hash value representing the earliest node to start with.
    #
    # = Examples
    #  bitbucket = BitBucket.new
    #  bitbucket.repos.changesets.list 'user-name', 'repo-name', :start => '...'
    #  bitbucket.repos.changesets.list 'user-name', 'repo-name', :start => '...' { |changeset| ... }
    #
    def list(user_name, repo_name, params={})
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      normalize! params
      filter! %w[ limit start], params

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

    # Gets a single changeset
    #
    # = Examples
    #  @bitbucket = BitBucket.new
    #  @bitbucket.repos.changesets.get 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6')
    #
    def get(user_name, repo_name, sha, params={})
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      _validate_presence_of sha
      normalize! params

      get_request("/1.0/repositories/#{user}/#{repo.downcase}/changesets/#{sha}", params)
    end
    alias :find :get

  end # Repos::Commits
end # BitBucket

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 lib/bitbucket_rest_api/repos/changesets.rb
zz_bitbucket_rest_api-0.1.10 lib/bitbucket_rest_api/repos/changesets.rb
zz_bitbucket_rest_api-0.1.9 lib/bitbucket_rest_api/repos/changesets.rb
zz_bitbucket_rest_api-0.1.8 lib/bitbucket_rest_api/repos/changesets.rb
bitbucket_rest_api2-0.9.5 lib/bitbucket_rest_api/repos/changesets.rb
bitbucket_rest_api-0.1.7 lib/bitbucket_rest_api/repos/changesets.rb