Ruby 更新Google文档后未加载图像

Ruby 更新Google文档后未加载图像,ruby,google-drive-api,Ruby,Google Drive Api,我在尝试更新包含图像的Google文档时遇到问题。在第一次修订中,图像将按预期加载。但是在用相同的HTML代码更新它之后,我一直得到一个微调器而不是图像 我使用的是谷歌创建的Ruby gem 以下是我的测试代码: # Setting up the client instance require "google/api_client" require "tempfile" client = Google::APIClient.new client.authorization.client_id

我在尝试更新包含图像的Google文档时遇到问题。在第一次修订中,图像将按预期加载。但是在用相同的HTML代码更新它之后,我一直得到一个微调器而不是图像

我使用的是谷歌创建的Ruby gem

以下是我的测试代码:

# Setting up the client instance

require "google/api_client"
require "tempfile"

client = Google::APIClient.new
client.authorization.client_id = "<CLIENTID>"
client.authorization.client_secret = "<CLIENTSECRET>"
client.authorization.redirect_uri = "<REDIRECTURI>"
client.authorization.scope = "https://www.googleapis.com/auth/drive"
client.authorization.access_token = "<ACCESSTOKEN>"
client.authorization.refresh_token = "<REFRESHTOKEN>"
drive = client.discovered_api("drive", "v2")

# Creating the document (IMAGE DISPLAYED CORRECTLY)

file = drive.files.insert.request_schema.new({"title" => "Test document", "mimeType" => "text/html"})
temp = Tempfile.new "temp.html"
temp.write "<h1>Testing!</h1><p>Lorem ipsum.</p><img width='400px' src='http://www.digitaleconomics.nl/wp-content/uploads/2013/04/see-how-your-google-results-measure-up-with-google-grader-video-6b8bbb4b41.jpg'>"
temp.rewind
media = Google::APIClient::UploadIO.new(temp, "text/html")
result = client.execute(:api_method => drive.files.insert, :body_object => file, :media => media, :parameters => {"uploadType" => "multipart", "convert" => true})
temp.close

# Updating the document (GETTING SPINNER INSTEAD OF IMAGE)

file = client.execute(:api_method => drive.files.get, :parameters => {"fileId" => result.data.to_hash["id"]}).data
file.title = "Updated test document"
temp = Tempfile.new "temp.html"
temp.write "<h1>Testing!</h1><p>Lorem ipsum.</p><img width='400px' src='http://www.digitaleconomics.nl/wp-content/uploads/2013/04/see-how-your-google-results-measure-up-with-google-grader-video-6b8bbb4b41.jpg'>"
temp.rewind
media = Google::APIClient::UploadIO.new(temp, "text/html")
result = client.execute(:api_method => drive.files.update, :body_object => file, :media => media, :parameters => {"uploadType" => "multipart", "convert" => true, "fileId" => result.data.to_hash["id"], "newRevision" => false})
temp.close
此外,将newRevision设置为false不会阻止创建新修订


有人能帮我吗?

文档文件总是创建新的修订。因为我们不计算文档文件的数量,也不使用用户的配额,所以这应该不是问题。旋转的声音看起来像个虫子,我们正在调查。嗨,伯库。你有时间调查这个错误吗?这里也报道了这个错误:你能看看吗?这似乎是一个类似的问题。