Module: GitHub::Payload::Helpers::PullRequest
- Included in:
- Formatter::PullRequestEvent
- Defined in:
- lib/github/payload/helpers/pull_request.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Meta
Methods included from Actions
Class Method Details
.sample_payload ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# 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 |
Instance Method Details
#pull ⇒ Object
7 8 9 |
# File 'lib/github/payload/helpers/pull_request.rb', line 7 def pull @pull ||= self.class.objectify(payload['pull_request']) end |
#summary_message ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/github/payload/helpers/pull_request.rb', line 15 def 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 ⇒ Object
11 12 13 |
# File 'lib/github/payload/helpers/pull_request.rb', line 11 def summary_url pull.html_url end |