首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails Drive Rest Api |使用google api客户端gem共享文件

Rails Drive Rest Api |使用google api客户端gem共享文件
EN

Stack Overflow用户
提问于 2017-01-10 07:59:38
回答 0查看 710关注 0票数 2

我正在构建一个实现一些驱动功能的应用程序。现在我正在尝试使用google-api-ruby-client gem共享一个文件。我在使用下面的代码时遇到了一些问题。

代码语言:javascript
复制
#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: "some@gmail.com")
@drive.create_permission(file_id:"0B8XBWuVEmvN8YS01OXNUcHhOYWs",permission_object: per, fields: "id", &callback)

当我执行这段代码时,回调显示如下:

代码语言:javascript
复制
{
"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."
 }

}

我不能解决这个错误。有人能帮我吗?

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41559034

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档