Class: Codepulse::GhCliClient

Inherits:
Object
  • Object
show all
Includes:
BaseClient
Defined in:
lib/codepulse/gh_cli_client.rb

Constant Summary collapse

DEFAULT_COMMAND =
"gh"
GRAPHQL_PAGE_SIZE =
50
ACTIVITY_PAGE_SIZE =
50

Instance Method Summary collapse

Constructor Details

#initialize(command: DEFAULT_COMMAND) ⇒ GhCliClient

Returns a new instance of GhCliClient.



14
15
16
17
# File 'lib/codepulse/gh_cli_client.rb', line 14

def initialize(command: DEFAULT_COMMAND)
  @command = command
  verify_cli_available
end

Instance Method Details

#pull_requests_with_activity(repository, state:, limit:) ⇒ Object

Fetches PRs with reviews and comments in a single GraphQL query. Returns array of PR hashes with embedded :reviews, :review_comments, :issue_comments.

Raises:



21
22
23
24
25
26
# File 'lib/codepulse/gh_cli_client.rb', line 21

def pull_requests_with_activity(repository, state:, limit:)
  owner, name = repository.split("/", 2)
  raise ConfigurationError, "Repository must be in the format owner/name" unless owner && name

  fetch_all_pull_requests(owner, name, graphql_states(state), limit)
end