lib/google/cloud/logging/credentials.rb in google-cloud-logging-0.20.1 vs lib/google/cloud/logging/credentials.rb in google-cloud-logging-0.21.0

- old
+ new

@@ -23,9 +23,19 @@ class Credentials < Google::Cloud::Credentials SCOPE = ["https://www.googleapis.com/auth/logging.admin"] PATH_ENV_VARS = %w(LOGGING_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE) JSON_ENV_VARS = %w(LOGGING_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON GCLOUD_KEYFILE_JSON) + + ## + # @private Create credentials with given scope and/or keyfile + def self.credentials_with_scope keyfile, scope = nil + if keyfile.nil? + default(scope: scope) + else + new(keyfile, scope: scope) + end + end end end end end