Updating the gem did the trick :)
From google_drive (0.3.7)
to google_drive (0.3.9)
Question
I'm getting this error lately :
Completed 500 Internal Server Error in 7609ms
GoogleDrive::Error (Updating cell https://spreadsheets.google.com/feeds/.../od6/private/full/R1C1 has failed: Missing resource version ID)
I haven't change anything, it worked fine before.
Using: Rails 3, gem 'google_drive'
Code:
def google_report
session = GoogleDrive.login(current_user.gmail, ActiveSupport::MessageEncryptor.new(SECRET).decrypt(current_user.gmail_pass))
asin = params[:asin]
@i_all = Item.where(:user_id => current_user.id, :asin => asin, :domain => params[:domain]).order("created_at desc")
# + 9 hours cuz of server time
time = (Time.now + 9.hours).strftime("%Y-%m-%d %H:%M:%S")
session.create_spreadsheet(asin + " " + time)
ws = session.spreadsheet_by_title(asin + " " + time).worksheets[0]
ws[1, 1] = "商品名"
ws[1, 2] = "ASIN"
...
@i_all.try(:each_with_index) do |i, index|
ws[index+2, 1] = i.title
ws[index+2, 2] = i.asin
...
begin
ws.save()
rescue GoogleDrive::Error
ws.save()
next
end
end
ws.save()
end
La solution 2
Updating the gem did the trick :)
From google_drive (0.3.7)
to google_drive (0.3.9)
Autres conseils
I think the fix was to add a version
https://developers.google.com/google-apps/spreadsheets/#specifying_a_version
I think it was optional, but they made it required.