Class: Dude::CodeManagement::Github::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dude/code_management/github/client.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



9
10
11
12
13
# File 'lib/dude/code_management/github/client.rb', line 9

def client
  @client ||= Faraday.new('https://api.github.com/', {
    headers: { Authorization: "token #{Dude::SETTINGS.dig(:github, :token)}" }
  })
end

#create_pull_request(issue:, owner:, repo:, params:) ⇒ Object



15
16
17
# File 'lib/dude/code_management/github/client.rb', line 15

def create_pull_request(issue:, owner:, repo:, params:)
  CreatePullRequest.new.call(client, issue: issue, owner: owner, repo: repo, params: params)
end

#health_checkObject



19
20
21
22
23
# File 'lib/dude/code_management/github/client.rb', line 19

def health_check
  client.get('https://api.github.com/user').status == 200
rescue StandardError
  false
end