class Policial::PullRequestEvent
Public: Parses a pull request event payload.
Attributes
payload[R]
Public Class Methods
new(payload)
click to toggle source
# File lib/policial/pull_request_event.rb, line 10 def initialize(payload) @payload = payload end
Public Instance Methods
pull_request_attributes()
click to toggle source
# File lib/policial/pull_request_event.rb, line 14 def pull_request_attributes { repo: @payload['repository']['full_name'], number: @payload['number'], head_sha: @payload['pull_request']['head']['sha'], user: @payload['pull_request']['user']['login'] } rescue NoMethodError nil end
should_investigate?()
click to toggle source
# File lib/policial/pull_request_event.rb, line 25 def should_investigate? !pull_request_attributes.nil? && ( @payload['action'] == 'opened' || @payload['action'] == 'synchronize' ) end