class Github::PullRequests

def comments

Access to PullRequests::Comments API
def comments
  @comments ||= ApiFactory.new 'PullRequests::Comments'
end

def commits(user_name, repo_name, request_id, params={})


github.pull_requests.commits 'user-name', 'repo-name', 'request-id'
github = Github.new
= Examples

List commits on a pull request
def commits(user_name, repo_name, request_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of request_id
  _normalize_params_keys(params)
  # _merge_mime_type(:pull_request, params)
  response = get_request("/repos/#{user}/#{repo}/pulls/#{request_id}/commits", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def create(user_name, repo_name, params={})


"base" => "master"
"head" => "octocat:new-feature",
"issue" => "5",
@github.pull_requests.create 'user-name', 'repo-name',

alternatively

"base" => "master"
"head" => "octocat:new-feature",
"body" => "Please pull this in!",
"title" => "Amazing new feature",
github.pull_requests.create 'user-name', 'repo-name',
github = Github.new :oauth_token => '...'
= Examples

* issue - Required number - Issue number in this repository to turn into a Pull Request.
an Issue number instead of title and body.
You can also create a Pull Request from an existing Issue by passing
= Alternative Input
Typically you would namespace head with a user like this: username:branch.
note: head and base can be either a sha or a branch name.
* :head - Required string - The branch where your changes are implemented.
* :base - Required string - The branch you want your changes pulled into.
* :body - Optional string
* :title - Required string
= Inputs

Create a pull request
def create(user_name, repo_name, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  # _merge_mime_type(:pull_request, params)
  _filter_params_keys(VALID_REQUEST_PARAM_NAMES, params)
  post_request("/repos/#{user}/#{repo}/pulls", params)
end

def files(user_name, repo_name, request_id, params={})


github.pull_requests.files 'user-name', 'repo-name', 'request-id'
github = Github.new
= Examples

List pull requests files
def files(user_name, repo_name, request_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of request_id
  _normalize_params_keys(params)
  # _merge_mime_type(:pull_request, params)
  response = get_request("/repos/#{user}/#{repo}/pulls/#{request_id}/files", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def get(user_name, repo_name, request_id, params={})


@pull_reqs.get 'user-name', 'repo-name', 'request-id'
@pull_reqs = Github::PullRequests.new

github.pull_requests.get 'user-name', 'repo-name', 'request-id'
github = Github.new
= Examples

Get a single pull request
def get(user_name, repo_name, request_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of request_id
  _normalize_params_keys(params)
  # _merge_mime_type(:pull_request, params)
  get_request("/repos/#{user}/#{repo}/pulls/#{request_id}", params)
end

def initialize(options = {})

Creates new Gists API
def initialize(options = {})
  super(options)
end

def list(user_name, repo_name, params={})


pull_reqs.pull_requests.list 'user-name', 'repo-name'
pull_reqs = Github::PullRequests.new

github.pull_requests.list { |req| ... }
github.pull_requests.list
github = Github.new :user => 'user-name', :repo => 'repo-name'
= Examples

List pull requests
def list(user_name, repo_name, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless (user? && repo?)
  _normalize_params_keys(params)
  _filter_params_keys(VALID_REQUEST_PARAM_NAMES, params)
  # _merge_mime_type(:pull_request, params)
  assert_valid_values(VALID_REQUEST_PARAM_VALUES, params)
  response = get_request("/repos/#{user}/#{repo}/pulls", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def merge(user_name, repo_name, request_id, params={})


github.pull_requests.merge 'user-name', 'repo-name', 'request-id'
github = Github.new
= Examples

:commit_message - Optional string - The message that will be used for the merge commit
= Inputs

Merge a pull request(Merge Button)
def merge(user_name, repo_name, request_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of request_id
  _normalize_params_keys(params)
  # _merge_mime_type(:pull_request, params)
  _filter_params_keys(VALID_REQUEST_PARAM_NAMES, params)
  put_request("/repos/#{user}/#{repo}/pulls/#{request_id}/merge", params)
end

def merged?(user_name, repo_name, request_id, params={})


github.pull_requests.merged? 'user-name', 'repo-name', 'request-id'
github = Github.new
= Examples

Check if pull request has been merged
def merged?(user_name, repo_name, request_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of request_id
  _normalize_params_keys(params)
  # _merge_mime_type(:pull_request, params)
  get_request("/repos/#{user}/#{repo}/pulls/#{request_id}/merge", params)
  true
rescue Github::Error::NotFound
  false
end

def update(user_name, repo_name, request_id, params={})


"state" => "open",
"body" => "Update body",
"title" => "Amazing new title",
github.pull_requests.update 'user-name', 'repo-name', 'request-id'
github = Github.new :oauth_token => '...'
= Examples

* :state - Optional string - State of this Pull Request. Valid values are open and closed.
* :body - Optional string
* :title - Optional string
= Inputs

Update a pull request
def update(user_name, repo_name, request_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of request_id
  _normalize_params_keys(params)
  _filter_params_keys(VALID_REQUEST_PARAM_NAMES, params)
  # _merge_mime_type(:pull_request, params)
  assert_valid_values(VALID_REQUEST_PARAM_VALUES, params)
  patch_request("/repos/#{user}/#{repo}/pulls/#{request_id}", params)
end