Method: Google::Auth::Credentials#initialize
- Defined in:
- lib/googleauth/credentials.rb
#initialize(source_creds, options = {}) ⇒ Credentials
Creates a new Credentials instance with the provided auth credentials, and with the default values configured on the class.
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/googleauth/credentials.rb', line 401 def initialize source_creds, = {} if source_creds.nil? raise InitializationError, "The source credentials passed to Google::Auth::Credentials.new were nil." end = symbolize_hash_keys @project_id = [:project_id] || [:project] @quota_project_id = [:quota_project_id] case source_creds when String, Pathname update_from_filepath source_creds, when Hash update_from_hash source_creds, else update_from_client source_creds end setup_logging logger: .fetch(:logger, :default) @project_id ||= CredentialsLoader.load_gcloud_project_id @env_vars = nil @paths = nil @scope = nil end |