Class: Aid::Scripts::Review::PullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/aid/scripts/review.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, title:, repo_name:) ⇒ PullRequest

Returns a new instance of PullRequest.



278
279
280
281
282
# File 'lib/aid/scripts/review.rb', line 278

def initialize(id:, title:, repo_name:)
  @id = id
  @title = title
  @url = "https://github.com/#{repo_name}/pull/#{id}"
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



276
277
278
# File 'lib/aid/scripts/review.rb', line 276

def id
  @id
end

#titleObject (readonly)

Returns the value of attribute title.



276
277
278
# File 'lib/aid/scripts/review.rb', line 276

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



276
277
278
# File 'lib/aid/scripts/review.rb', line 276

def url
  @url
end

Instance Method Details

#mark_ready_for_review!Object

rubocop:disable Metrics/MethodLength



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/aid/scripts/review.rb', line 285

def mark_ready_for_review!
  cmd = <<~CMD
    hub api graphql \
      -H "Accept: application/vnd.github.shadow-cat-preview+json" \
      -f query='
        mutation MarkPullRequestReady {
          markPullRequestReadyForReview(
            input: {
              pullRequestId:"#{graphql_id}"
            }
          ) {
            pullRequest {
              isDraft
              number
            }
          }
        }
      '
  CMD

  `#{cmd}`
end