我正在构建一个实现一些驱动器功能的应用程序。现在我试图使用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行 –