Use Octokit::Client for both .com and Enterprise

Octokit:EnterpriseAdminClient is only meant to be used for GHE admin
panel endpoints, such as Admin Stats, Management Console, etc.

This repairs GHE functionality by passing the API endpoint parameters
into Octokit::Client and letting it handle the rest.
This commit is contained in:
Eli Perkins 2016-11-22 11:37:29 -05:00
parent 88cbcd22ed
commit 881ecc161c

View File

@ -23,7 +23,7 @@ module GitHubChangelogGenerator
# @option options [Boolean] :http_cache Use ActiveSupport::Cache::FileStore to cache http requests # @option options [Boolean] :http_cache Use ActiveSupport::Cache::FileStore to cache http requests
# @option options [Boolean] :cache_file If using http_cache, this is the cache file path # @option options [Boolean] :cache_file If using http_cache, this is the cache file path
# @option options [Boolean] :cache_log If using http_cache, this is the cache log file path # @option options [Boolean] :cache_log If using http_cache, this is the cache log file path
def initialize(options = {}) # rubocop:disable Metrics/CyclomaticComplexity def initialize(options = {})
@options = options || {} @options = options || {}
@user = @options[:user] @user = @options[:user]
@project = @options[:project] @project = @options[:project]
@ -40,8 +40,7 @@ module GitHubChangelogGenerator
@github_options[:access_token] = @github_token unless @github_token.nil? @github_options[:access_token] = @github_token unless @github_token.nil?
@github_options[:api_endpoint] = @options[:github_endpoint] unless @options[:github_endpoint].nil? @github_options[:api_endpoint] = @options[:github_endpoint] unless @options[:github_endpoint].nil?
client_type = @options[:github_endpoint].nil? ? Octokit::Client : Octokit::EnterpriseAdminClient @client = Octokit::Client.new(@github_options)
@client = client_type.new(@github_options)
end end
def init_cache def init_cache