Module: GitHub::Client::Commits

Included in:
GitHub::Client
Defined in:
lib/github_api_v3/client/commits.rb

Overview

Methods for the Commits API.

Instance Method Summary collapse

Instance Method Details

#commit(owner, repo, sha) ⇒ Hash

Get a single commit.

Parameters:

  • owner (String)

    The repository owner.

  • repo (String)

    The repository name.

  • sha (String)

    The SHA of the commit.

Returns:

  • (Hash)

    The commit information.

See Also:



32
33
34
# File 'lib/github_api_v3/client/commits.rb', line 32

def commit(owner, repo, sha)
  get "/repos/#{owner}/#{repo}/commits/#{sha}"
end

#commits(owner, repo, options = {}) ⇒ Array

List commits on a repository.

Parameters:

  • owner (String)

    The repository owner.

  • repo (String)

    The repository name.

  • options (Hash) (defaults to: {})

    Optional parameters.

Options Hash (options):

  • :sha (String)

    Sha or branch to start listing commits from.

  • :path (String)

    Only commits containing this file path will be returned.

  • :author (String)

    GitHub login, name, or email by which to filter by commit author.

  • :since (String)

    ISO 8601 date to return commits after.

  • :until (String)

    ISO 8601 date to return commits before.

Returns:

  • (Array)

    A list of commits.

See Also:



21
22
23
# File 'lib/github_api_v3/client/commits.rb', line 21

def commits(owner, repo, options={})
  get "/repos/#{owner}/#{repo}/commits", params: options
end

#compare_commits(owner, repo, base, head) ⇒ Hash

Compare two commits.

Parameters:

  • owner (String)

    The repository owner.

  • repo (String)

    The repository name.

  • base (String)

    The base SHA of the commit.

  • head (String)

    The head SHA of the commit.

Returns:

  • (Hash)

    Comparison information.

See Also:



44
45
46
# File 'lib/github_api_v3/client/commits.rb', line 44

def compare_commits(owner, repo, base, head)
  get "/repos/#{owner}/#{repo}/compare/#{base}...#{head}"
end