我正在構建一個實現一些驅動器功能的應用程序。現在我試圖使用google-api-ruby-client gem共享一個文件。我有一些麻煩使用下一個代碼。Rails Drive Rest Api |使用谷歌api客戶端共享文件gem
#Here, I create a DriveService object and I authorize it.
#This works fine. In my app I list drive files well.
@drive = Google::Apis::DriveV3::DriveService.new
@drive.authorization = @token[:access_token]
#Here, first I create a permission object with some parameters
#Then I call create_permission to share the file to a other user
per=Google::Apis::DriveV3::Permission.new(type: "user", role: "writer",email_address: "[email protected]")
@drive.create_permission(file_id:"0B8XBWuVEmvN8YS01OXNUcHhOYWs",permission_object: per, fields: "id", &callback)
當我執行這個代碼,回調錶明這一點:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "The permission type field is required.",
"locationType": "other",
"location": "permission.type"
}
],
"code": 400,
"message": "The permission type field is required."
}
}
我解決不了這個錯誤。有人能幫我嗎?
調試器指向@ drive.create_permission行 –