###Authorization Most interactions with Google APIs require users to authorize applications via OAuth 2.0. The client library uses Signet to handle most aspects of authorization. For additional details about Google's OAuth support, see Google Developers.
Credentials can be managed at the connection level, as shown, or supplied on a per-request basis when calling execute. For server-to-server interactions, like those between a web application and Google Cloud Storage, Prediction, or BigQuery APIs, use service accounts. Assertions for service accounts are made with Google::APIClient::JWTAsserter.
client = Google::APIClient.new
key = Google::APIClient::PKCS12.load_key('client.p12', 'notasecret')
service_account = Google::APIClient::JWTAsserter.new(
'123456-abcdef@developer.gserviceaccount.com',