Class: Gcloud::Datastore::Credentials

Inherits:
Credentials show all
Defined in:
lib/gcloud/datastore/credentials.rb

Overview

Authentication credentials to Google Cloud. The most common way to create this object is to provide the path to the JSON keyfile downloaded from Google Cloud.

developers.google.com/accounts/docs/application-default-credentials

Constant Summary collapse

SCOPE =

:nodoc:

["https://www.googleapis.com/auth/datastore",
"https://www.googleapis.com/auth/userinfo.email"]
ENV_VARS =
["DATASTORE_KEYFILE"]

Constants inherited from Credentials

Credentials::AUDIENCE, Credentials::TOKEN_CREDENTIAL_URI

Instance Attribute Summary

Attributes inherited from Credentials

#client

Instance Method Summary collapse

Methods inherited from Credentials

default, #initialize, sdk_default_creds

Constructor Details

This class inherits a constructor from Gcloud::Credentials

Instance Method Details

#sign_http_request(request) ⇒ Object

Sign Oauth2 API calls.



32
33
34
35
36
37
38
# File 'lib/gcloud/datastore/credentials.rb', line 32

def sign_http_request request #:nodoc:
  if @client
    @client.fetch_access_token! if @client.expired?
    @client.generate_authenticated_request request: request
  end
  request
end