Sha256: bb699966c46b2c42187dd1f73ef98ff5703bfcb8178e1c6d769743966c8f5c64

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true
module BitBucket
  class Repos::Sources < API
    # Gets a list of the src in a repository.
    #
    # = Examples
    #  @bitbucket = BitBucket.new
    #  @bitbucket.repos.sources.list 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6', 'app/contorllers/')
    #
    def list(user_name, repo_name, sha, path)
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      _validate_presence_of(sha, path)

      get_request("/1.0/repositories/#{user}/#{repo.downcase}/src/#{sha}/#{path}")
    end
    alias all list

    # Gets information about an individual file. This method returns the file's
    # size and contents.  If the file is encoded, this method returns the files
    # encoding; Currently, Bitbucket supports only base64 encoding.
    #
    # = Examples
    #  @bitbucket = BitBucket.new
    #  @bitbucket.repos.sources.get 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6', 'app/assets/images/logo.jpg')
    #
    def get(user_name, repo_name, sha, path)
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      _validate_presence_of(sha, path)

      get_request("/1.0/repositories/#{user}/#{repo.downcase}/raw/#{sha}/#{path}")
    end
    alias find get
  end # Repos::Sources
end # BitBucket

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbuckets-0.2.0 lib/bitbucket_rest_api/repos/sources.rb