2

我能够创建..一些东西......但我在我的帐户的 web 视图中看不到它

require "gdata"
require "awesome_print"
require "nokogiri"


@client = GData::Client::DocList.new
@client.clientlogin('me', "mypass")

def post_doc
  # Return documents the authenticated user owns
  feed = @client.get('https://docs.google.com/feeds/documents/private/full/-/mine').to_xml
  entry = feed.elements['entry']  # first <atom:entry>

  acl_entry = <<-EOF
  <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
    <category scheme='http://schemas.google.com/g/2005#kind'
      term='http://schemas.google.com/acl/2007#accessRule'/>
    <title>Testing Ruby GData gem</title>
    <gAcl:role value='writer'/>
    <gAcl:scope type='user' value='idk@example.com'/>
  </entry>
  EOF

  # Regex the document id out from the full <atom:id>.
  # http://docs.google.com/feeds/documents/private/full/document%3Adfrk14g25fdsdwf -> document%3Adfrk14g25fdsdwf
  ap entry.elements['id']
  doc_id = entry.elements['id'].text[/full\/(.*%3[aA].*)$/, 1]
  response = @client.post("https://docs.google.com/feeds/acl/private/full/#{doc_id}", acl_entry)

end

如果我更改 gAcl:scope type='user' 字段的值,我似乎只能上传文档。

在我的 google 帐户上,Docs 不见了,取而代之的是 google drive,这会是个问题吗?

另外,某处的条目中是否有字段列表,因此我可以指定要创建的文档的正文?

4

0 回答 0