Sha256: 22e0a0195cd3e650fb2a8351726538c337e1bad8a6e6230f2f35fcf52ae706b2

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 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>:org</tt> - Optional string - the name of the service that is being called.
    #
    # = Examples
    #  github = Github.new
    #  github.repos.forks.create 'user-name', 'repo-name',
    #    "org" =>  "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

5 entries across 5 versions & 1 rubygems

Version Path
github_api-0.9.5 lib/github_api/repos/forks.rb
github_api-0.9.4 lib/github_api/repos/forks.rb
github_api-0.9.3 lib/github_api/repos/forks.rb
github_api-0.9.2 lib/github_api/repos/forks.rb
github_api-0.9.1 lib/github_api/repos/forks.rb