为了检索文件夹的内容,我必须使用下面的url‘https://www.googleapis.com/drive/v2/files?q=’,所以我认为它应该通过传递一个额外的参数来工作
@client.execute(
:api_method => @drive.files.list ,
:parameters =>{q=> "title='root'" })但是这不起作用。
出现错误:{"errors"=>{"domain"=>"global","reason"=>"invalid","message"=>"Invalid Value","locationType"=>"parameter","location"=>"q"},"code"=>400,"message"=>"Invalid Value"}
当我看到请求uri时,这一点非常明显。
https://www.googleapis.com/drive/v2/files?q=title%253D%27levelA%27我的第一次尝试是使用URI.encode "title='root'“,这两种方法都不起作用。我真的不知道我怎么能保持单引号?
最好的,菲利普
附注:指向上述gem http://rubydoc.info/github/google/google-api-ruby-client/frames的链接
发布于 2013-01-23 05:40:16
好了,现在我找到了一个有效的解决方案,尽管它是一个非常麻烦的解决方案。
search = CGI.escape("q='root'")
u.query = search
u= Addressable::URI.parse "https://www.googleapis.com/drive/v2/files"
req=Google::APIClient::Request.new(:uri=> u)
client.execute req我希望这能帮助一些人..
https://stackoverflow.com/questions/14467918
复制相似问题