module GitHub::Payload::Helpers::PullRequest

Public Class Methods

sample_payload() click to toggle source
# File lib/github/payload/helpers/pull_request.rb, line 29
def self.sample_payload
  repo_owner = "mojombo"
  repo_name = "magik"
  pull_user = "foo"
  pull_number = 5
  HelpersWithMeta.sample_payload.merge(
    "action" => "opened",
    "pull_request" => {
      "number" => pull_number,
      "commits" => 1,
      "state" => "open",
      "title" => "booya",
      "body"  => "boom town",
      "user" => { "login" => "#{pull_user}" },
      "head" => {"label" => "#{pull_user}:feature"},
      "base" => {"label" => "#{repo_owner}:master"},
      "html_url" => "https://github.com/#{repo_owner}/#{repo_name}/pulls/#{pull_number}"
    }
  )
end

Public Instance Methods

pull() click to toggle source
# File lib/github/payload/helpers/pull_request.rb, line 7
def pull
  @pull ||= self.class.objectify(payload['pull_request'])
end
summary_message() click to toggle source
# File lib/github/payload/helpers/pull_request.rb, line 15
def summary_message
  base_ref = pull.base.label.split(':').last
  head_ref = pull.head.label.split(':').last

  "[%s] %s %s pull request #%d: %s (%s...%s)" % [
    repo.name,
    sender.login,
    action,
    pull.number,
    pull.title,
    base_ref,
    head_ref != base_ref ? head_ref : pull.head.label]
end
summary_url() click to toggle source
# File lib/github/payload/helpers/pull_request.rb, line 11
def summary_url
  pull.html_url
end