Sha256: 1eb34332b3ee9fd9755f4a8147ec20e02009d438d332bcb252b692257bb0c744

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true
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("/1.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('/1.0/user/follows', params)
      return response unless block_given?

      response.each { |el| yield el }
    end
  end # Repos::Watching
end # BitBucket

Version data entries

1 entries across 1 versions & 1 rubygems

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