Class: DriveV3::CreateCredential
- Inherits:
-
Object
- Object
- DriveV3::CreateCredential
- Defined in:
- lib/drive_v3/create_credential.rb
Overview
Creates a Google API credential with an access token
Class Method Summary collapse
-
.call(credential_source, scopes, credential_factory = Google::Auth::DefaultCredentials) ⇒ Object
Creates a Google API credential with an access token.
Class Method Details
.call(credential_source, scopes, credential_factory = Google::Auth::DefaultCredentials) ⇒ Object
Creates a Google API credential with an access token
This wraps the boiler plate code into one function to make constructing a credential easy and less error prone.
28 29 30 31 32 33 34 35 36 |
# File 'lib/drive_v3/create_credential.rb', line 28 def self.call( credential_source, scopes, credential_factory = Google::Auth::DefaultCredentials ) return credential_source if credential?(credential_source) credential_source ||= default_credential_source = (credential_source, scopes) credential_factory.make_creds().tap(&:fetch_access_token) end |