Sha256: 95d45e53b1573720e8c0141b8e383d441d8f442916e7be7ced64b9fadc244e10

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

# encoding: utf-8

module BitBucket
  class Repos::Following < API

    # List repo followers
    #
    # = Examples
    #  bitbucket = BitBucket.new :user => 'user-name', :repo => 'repo-name'
    #  bitbucket.repos.following.followers
    #  bitbucket.repos.following.followers { |watcher| ... }
    #
    def followers(user_name, repo_name, params={})
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      normalize! params

      response = get_request("/2.0/repositories/#{user}/#{repo.downcase}/followers/", params)
      return response unless block_given?
      response.each { |el| yield el }
    end

    # List repos being followed by the authenticated user
    #
    # = Examples
    #  bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
    #  bitbucket.repos.following.followed
    #
    def followed(*args)
      params = args.extract_options!
      normalize! params

      response = get_request("/2.0/user/follows", params)
      return response unless block_given?
      response.each { |el| yield el }
    end

  end # Repos::Watching
end # BitBucket

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bitbucket_rest_api2-0.9.1 lib/bitbucket_rest_api/repos/following.rb
bitbucket_rest_api2-0.2.2 lib/bitbucket_rest_api/repos/following.rb
bitbucket_rest_api2-0.2.1 lib/bitbucket_rest_api/repos/following.rb
bitbucket_rest_api2-0.2.0 lib/bitbucket_rest_api/repos/following.rb