Tag: google drive sdk

如何使用google-api-ruby客户端将Resumable上传到Google云端硬盘?

我在将我的Linux桌面上的大文件上传到GDrive时遇到问题(通过使用不提供恢复甚至监控较大上传的Grive)。 所以我开始尝试使用google-api-ruby编写一个小脚本来完成这项工作。 由于Google推出了有关Resumable上传的文档说明 – https://developers.google.com/drive/manage-uploads#resumable – 我试图使用google-api-ruby实现Resumable上传,并找到了Google::APIClient::ResumableUpload类。 样本对于理解这个rubyish API如何工作的原理非常有用,但是样本没有提到Resumable uploads的使用 。 Google::APIClient::ResumableUpload类是用于文档所讨论的可恢复上传 ,还是由此Ruby客户端提供的对话类? 当我调用execute或execute时, Google::APIClient::Result构造函数会消耗我得到的Google::APIClient::Result ! 在Google::APIClient实例上。 据我所知, execute方法仅适用于暴露给Discovery API的 Google API方法(例如drive.files.insert )。 不幸的是, Resumable上传与以下URI相关联: https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable 并且似乎还没有成为Discovery的一部分或者整合成一个“更清洁”的URI方案(为什么upload/drive而不是drive/upload ?)。 是否可以对此API URI使用Google::APIClient 执行方法,以便将其与Google::APIClient::ResumableUpload结合使用oder我是否必须自己实施可恢复上传 (例如,使用em-http-request )?

在Google云端硬盘API中接收错误403 – 超出未经身份validation的使用的每日限制。 继续使用需要注册

我正在使用Google Drive API进行ruby,我正在尝试将文件插入用户驱动器。 我可以成功插入文件,但是当我尝试获取文件Self Link时,这是返回的URL https://www.googleapis.com/drive/v2/files/1PxrbKaO2xwOonUO0TB0FO3pkZDnSmRKTvIUmXw0vL6w ,表示我已超出未经身份validation的请求数。 好吧,我很确定我已通过身份validation,因为我遵循了所有教程并且代码几乎相同。 谁知道为什么会这样? 为什么我可以插入文件,但无法查看它的Self Link? 以下是用户允许应用程序进行离线访问后,在驱动器中创建文档的代码: SCOPES = [ ‘https://www.googleapis.com/auth/drive’, ‘https://www.googleapis.com/auth/userinfo.email’, ‘https://www.googleapis.com/auth/userinfo.profile’ ] class DriveAuthenticator def self.create_document(user, title, description, parent_title, user_array) client = DriveAuthenticator.initiate_client if user.google_id.present? if DriveAuthenticator.authenticate_client client, user parent_id = get_parent_id client, parent_title file_data = insert_empty_file client, title, description, DOCUMENT_MIME_TYPE, parent_id return file_data.selfLink end end end private […]

如何调试Ruby google-api-client的HTTP

我正在尝试使用google-api-client与Google云端硬盘集成。 由于有很多东西正在进行,我希望能够看到线路上的内容(http级别)。 似乎客户端使用Faraday进行http连接。 我如何从法拉第中获取线路调试?