Class: Chandler::GitHub::Client

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/chandler/github/client.rb

Overview

A thin wrapper around Octokit::Client that adds support for automatic GitHub Enterprise, .netrc, and ENV token-based authentication.

Instance Method Summary collapse

Constructor Details

#initialize(host: "github.com", environment: ENV, octokit_client: Octokit::Client) ⇒ Client

Returns a new instance of Client.



12
13
14
15
16
17
18
19
# File 'lib/chandler/github/client.rb', line 12

def initialize(host: "github.com",
               environment: ENV,
               octokit_client: Octokit::Client)
  options = {}
  options.merge!(detect_auth_option(environment))
  options.merge!(detect_enterprise_endpoint(host))
  super(octokit_client.new(options))
end

Instance Method Details

#login!Object



21
22
23
24
# File 'lib/chandler/github/client.rb', line 21

def login!
  return if 
  raise netrc ? NetrcAuthenticationFailure : TokenAuthenticationFailure
end