title: Bad request error with ruby google-api-client when querying Google Admin Directory API
body: <p>I am using version 0.6.4 of google-api-client ruby gem to query Google Admin Directory API.</p>
  
  <p>Here is my session in ruby console:</p>
  
  <pre><code>require 'rubygems'
  require 'google/api_client'
  
  SERVICE_ACCOUNT_CLIENT_ID = "SOME_STRING.apps.googleusercontent.com"
  SERVICE_ACCOUNT_EMAIL = "SOME_STRING@developer.gserviceaccount.com"
  SERVICE_ACCOUNT_PKCS12_FILE_PATH = "/path/to/privatekey.p12"
  
  key = Google::APIClient::KeyUtils.load_from_pkcs12(SERVICE_ACCOUNT_PKCS12_FILE_PATH, 'notasecret')
  asserter = Google::APIClient::JWTAsserter.new(SERVICE_ACCOUNT_EMAIL, "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly", key)
  client = Google::APIClient.new
  client.authorization = asserter.authorize
  dir_api = client.discovered_api('admin', 'directory_v1')
  resp = client.execute(:api_method =&gt; dir_api.chromeosdevices.list, :parameters =&gt; {'customerId'=&gt;SERVICE_ACCOUNT_CLIENT_ID})
  
  resp.body
  =&gt; "{\n \"error\": {\n  \"errors\": [\n   {\n    \"domain\": \"global\",\n    \"reason\": \"badRequest\",\n    \"message\": \"Bad Request\"\n   }\n  ],\n   \"code\": 400,\n  \"message\": \"Bad Request\"\n }\n}\n"
  </code></pre>
  
  <p>I am probably missing something obvious here but it is unclear from the error response what is missing in the request.  Would appreciate any help/pointers in the right direction.</p>
  
  <p>Thanks.</p>