Sha256: 567977f7f5b9e208f153409cfd902d13c58ee03d3306a27509dfc02d9cd11550

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8

module Github
  class Repos::Forks < API

    # List repository forks
    #
    # = Parameters
    # * <tt>:sort</tt> - newest, oldest, watchers, default: newest
    #
    # = Examples
    #  github = Github.new
    #  github.repos.forks.list 'user-name', 'repo-name'
    #  github.repos.forks.list 'user-name', 'repo-name' { |fork| ... }
    #
    def list(*args)
      arguments(args, :required => [:user, :repo])

      response = get_request("/repos/#{user}/#{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
    #
    # = Inputs
    # * <tt>:organization</tt> - Optional string - the name of the service that is being called.
    #
    # = Examples
    #  github = Github.new
    #  github.repos.forks.create 'user-name', 'repo-name',
    #    "organization" => "github"
    #
    def create(*args)
      arguments(args, :required => [:user, :repo])

      post_request("/repos/#{user}/#{repo}/forks", arguments.params)
    end

  end # Repos::Forks
end # Github

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
github_api-0.11.3 lib/github_api/repos/forks.rb
github_api-0.11.2 lib/github_api/repos/forks.rb
github_api-0.11.1 lib/github_api/repos/forks.rb
github_api-0.11.0 lib/github_api/repos/forks.rb
github_api-0.10.2 lib/github_api/repos/forks.rb
github_api-0.10.1 lib/github_api/repos/forks.rb
github_api-0.10.0 lib/github_api/repos/forks.rb
github_api-0.9.7 lib/github_api/repos/forks.rb
github_api-0.9.6 lib/github_api/repos/forks.rb