Sha256: ea2c125a8c8ee997dccc85e33f4ed3a4cf652e81c58eca684c889b7bc7206deb

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8

module Github
  class Client::Repos::Forks < API
    # List repository forks
    #
    # @param [Hash] params
    # @input params [String] :sort
    #   The sort order. Can be either newest, oldest, or stargazers.
    #   Default: newest
    #
    # @example
    #   github = Github.new
    #   github.repos.forks.list 'user-name', 'repo-name'
    #   github.repos.forks.list 'user-name', 'repo-name' { |fork| ... }
    #
    # @api public
    def list(*args)
      arguments(args, required: [:user, :repo])

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

    # Create a fork for the authenticated user
    #
    # @param [Hash] params
    # @input params [String] :organization
    #   The organization login. The repository will be forked into
    #   this organization.
    #
    # @example
    #   github = Github.new
    #   github.repos.forks.create 'user-name', 'repo-name',
    #     organization: "github"
    #
    # @api public
    def create(*args)
      arguments(args, required: [:user, :repo])

      post_request("/repos/#{arguments.user}/#{arguments.repo}/forks", arguments.params)
    end
  end # Client::Repos::Forks
end # Github

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
github_api-0.17.0 lib/github_api/client/repos/forks.rb
github_api-0.16.0 lib/github_api/client/repos/forks.rb
github_api-0.15.0 lib/github_api/client/repos/forks.rb
github_api-0.14.5 lib/github_api/client/repos/forks.rb
github_api-0.14.4 lib/github_api/client/repos/forks.rb
github_api-0.14.3 lib/github_api/client/repos/forks.rb
github_api-0.14.2 lib/github_api/client/repos/forks.rb
github_api-0.14.1 lib/github_api/client/repos/forks.rb
github_api-0.14.0 lib/github_api/client/repos/forks.rb
github_api-0.13.1 lib/github_api/client/repos/forks.rb
github_api-0.13.0 lib/github_api/client/repos/forks.rb
github_api-0.12.4 lib/github_api/client/repos/forks.rb
github_api-0.12.3 lib/github_api/client/repos/forks.rb
github_api-0.12.2 lib/github_api/client/repos/forks.rb
github_api-0.12.1 lib/github_api/client/repos/forks.rb
github_api-0.12.0 lib/github_api/client/repos/forks.rb