0

目前我正在尝试从坐标 api 获取我的工作,并使用 google api 客户端 gem 获取 google 坐标 api。一切似乎都很好。我可以在终端中看到呼叫,但响应始终为 null ,代码为 500 。有人可以帮忙吗???

api_client = Google::APIClient.new  
        path_to_key_file ="app/assets/2.p12"
        passphrase = "notasecret"
        key = Google::APIClient::PKCS12.load_key(path_to_key_file, passphrase)
        asserter = Google::APIClient::JWTAsserter.new(
       'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
       'https://www.googleapis.com/auth/coordinate',
       key)
        api_client.authorization = asserter.authorize()
        @code=api_client.authorization.access_token
        @token=api_client.authorization.fetch_access_token
        #api_client.execute
        coordinate = api_client.discovered_api('coordinate')
        @response = api_client.execute(
        :api_method => coordinate.jobs.list,
        :parameters => {
          'teamId' => "xxxxxxxxxxxxxxxxxxxxxx",
          #"lat" => 47.670188,
          #"lng"=> -122.196335,
          #"address" =>"747 6th St S, Kirkland WA 98033",
          #'title' => "from local",
          'key' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
     }
      )
4

1 回答 1

0

找到了解决方案.....我必须让服务帐户代表拥有坐标的用户行事。可以在此处找到文档https://developers.google.com/drive/delegation

于 2013-10-21T08:04:15.440 回答