This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'octokit/connection'
|
||||
require 'octokit/configurable'
|
||||
require 'octokit/warnable'
|
||||
require 'octokit/enterprise_admin_client/admin_stats'
|
||||
require 'octokit/enterprise_admin_client/license'
|
||||
require 'octokit/enterprise_admin_client/orgs'
|
||||
require 'octokit/enterprise_admin_client/search_indexing'
|
||||
require 'octokit/enterprise_admin_client/users'
|
||||
|
||||
module Octokit
|
||||
# EnterpriseAdminClient is only meant to be used by GitHub Enterprise Admins
|
||||
# and provides access the Admin only API endpoints including Admin Stats,
|
||||
# Management Console, and the Search Indexing API.
|
||||
#
|
||||
# @see Octokit::Client Use Octokit::Client for regular API use for GitHub
|
||||
# and GitHub Enterprise.
|
||||
# @see https://developer.github.com/v3/enterprise/
|
||||
class EnterpriseAdminClient
|
||||
include Octokit::Configurable
|
||||
include Octokit::Connection
|
||||
include Octokit::Warnable
|
||||
include Octokit::EnterpriseAdminClient::AdminStats
|
||||
include Octokit::EnterpriseAdminClient::License
|
||||
include Octokit::EnterpriseAdminClient::Orgs
|
||||
include Octokit::EnterpriseAdminClient::SearchIndexing
|
||||
include Octokit::EnterpriseAdminClient::Users
|
||||
|
||||
def initialize(options = {})
|
||||
# Use options passed in, but fall back to module defaults
|
||||
#
|
||||
# rubocop:disable Style/HashEachMethods
|
||||
#
|
||||
# This may look like a `.keys.each` which should be replaced with `#each_key`, but
|
||||
# this doesn't actually work, since `#keys` is just a method we've defined ourselves.
|
||||
# The class doesn't fulfill the whole `Enumerable` contract.
|
||||
Octokit::Configurable.keys.each do |key|
|
||||
# rubocop:enable Style/HashEachMethods
|
||||
instance_variable_set(:"@#{key}", options[key] || Octokit.instance_variable_get(:"@#{key}"))
|
||||
end
|
||||
|
||||
login_from_netrc unless user_authenticated? || application_authenticated?
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user