Sha256: 44479b0ddcf44b79b4d7ae471482350237daad1319fe1912ccc3c8b233ef96ac

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

require_relative 'abstract_issue'

module Geet
  module GitHub
    class PR < AbstractIssue
      def self.create(repository, title, description, head, api_helper)
        request_address = "#{api_helper.repo_link}/pulls"
        request_data = { title: title, body: description, head: head, base: 'master' }

        response = api_helper.send_request(request_address, data: request_data)

        issue_number = response.fetch('number')

        new(repository, issue_number, api_helper)
      end

      def link
        "https://github.com/#{@repository.owner}/#{@repository.repo}/pull/#{@issue_number}"
      end

      def request_review(reviewers)
        request_data = { reviewers: reviewers }
        request_address = "#{@api_helper.repo_link}/pulls/#{@issue_number}/requested_reviewers"

        @api_helper.send_request(request_address, data: request_data)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geet-0.1.4 lib/geet/git_hub/pr.rb
geet-0.1.3 lib/geet/git_hub/pr.rb
geet-0.1.2 lib/geet/git_hub/pr.rb
geet-0.1.1 lib/geet/git_hub/pr.rb
geet-0.1.0 lib/geet/git_hub/pr.rb