Class: Chandler::GitHub::Client
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Chandler::GitHub::Client
- 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
-
#initialize(host: "github.com", environment: ENV, octokit_client: Octokit::Client) ⇒ Client
constructor
A new instance of Client.
- #login! ⇒ Object
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) = {} .merge!(detect_auth_option(environment)) .merge!(detect_enterprise_endpoint(host)) super(octokit_client.new()) end |
Instance Method Details
#login! ⇒ Object
21 22 23 24 |
# File 'lib/chandler/github/client.rb', line 21 def login! return if login raise netrc ? NetrcAuthenticationFailure : TokenAuthenticationFailure end |