class Github::Repos::Statuses

The Status API allows external services to mark commits with a success, failure, error, or pending state, which is then reflected in pull requests involving those commits.

Public Instance Methods

all(*args)
Alias for: list
create(*args) click to toggle source

Create a status

Inputs

  • :state - Required string - State of the status - can be one of

    pending, success, error, or failure.
  • :target_url - Optional string - Target url to associate with this

    status. This URL will be linked from the GitHub UI to allow users
    to easily see the ‘source’ of the Status.
  • :description - Optional string - Short description of the status

Examples

github = Github.new
github.repos.statuses.create 'user-name', 'repo-name', 'sha',
  "state" =>  "success",
  "target_url" => "http://ci.example.com/johndoe/my-repo/builds/sha",
  "description" => "Successful build #3 from origin/master"
# File lib/github_api/repos/statuses.rb, line 51
def create(*args)
  arguments(args, :required => [:user, :repo, :sha]) do
    sift VALID_STATUS_PARAM_NAMES, :recursive => false
    assert_required REQUIRED_PARAMS
  end
  params = arguments.params

  post_request("/repos/#{user}/#{repo}/statuses/#{sha}", params)
end
list(*args) { |el| ... } click to toggle source

List Statuses for a specific SHA

Examples

github = Github.new
github.repos.statuses.list 'user-name', 'repo-name', 'sha'
github.repos.statuses.list 'user-name', 'repo-name', 'sha' { |status| ... }
# File lib/github_api/repos/statuses.rb, line 24
def list(*args)
  arguments(args, :required => [:user, :repo, :sha])
  params = arguments.params

  response = get_request("/repos/#{user}/#{repo}/statuses/#{sha}", params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all