Sha256: cd71d1d6df2bc79f4411c3c8b1d7ac99ef16f9b3eeb6d96fd3849d936d3a10a7

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

module Octospy
  class Parser
    module PullRequest
      def parse_pull_request_event
        {
          status: "#{@event.payload.action} pull request ##{@event.payload.number}",
          title: @event.payload.pull_request.title,
          body: "#{@event.payload.pull_request.body}".split_lfbl,
          link: @event.payload.pull_request._links.html.attrs[:href]
        }
      end

      def parse_pull_request_review_comment_event
        if @event.payload.comment.pull_request_url
          url = @event.payload.comment.pull_request_url
          pull_id = url.match(/\/pulls\/([0-9]+)/)[1]
          pull = Octokit.pull(@event.repo.name, pull_id)
          title = "#{pull.title}: #{@event.payload.comment.path}"
        else
          title = @event.payload.comment.path
        end

        {
          status: "commented on pull request",
          title: title,
          body: "#{@event.payload.comment.body}".split_lfbl,
          link: @event.payload.comment._links.html.href
        }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
octospy-0.2.0 lib/octospy/parser/pull_request.rb
octospy-0.1.1 lib/octospy/parser/pull_request.rb
octospy-0.1.0 lib/octospy/parser/pull_request.rb
octospy-0.0.8 lib/octospy/parser/pull_request.rb
octospy-0.0.7 lib/octospy/parser/pull_request.rb
octospy-0.0.6 lib/octospy/parser/pull_request.rb
octospy-0.0.5 lib/octospy/parser/pull_request.rb
octospy-0.0.4 lib/octospy/parser/pull_request.rb