Skip to content

Commit

Permalink
A bit more cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
nalanj committed Sep 6, 2009
1 parent 0f99e47 commit 28582df
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/google_spreadsheet.rb
Expand Up @@ -486,20 +486,20 @@ def save()

while current_cell < cells
batch_count = 0
xml = <<-"EOS"
xml = <<-EOS
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gs="http://schemas.google.com/spreadsheets/2006">
<id>#{h(@cells_feed_url)}</id>
EOS

while batch_count <= 500
until batch_count >= 500
row,col = @modified[current_cell]
value = @cells[[row, col]]
entry = cell_entries[[row, col]]
id = entry.search("id").text
edit_url = entry.search("link[@rel='edit']")[0]["href"]
xml << <<-"EOS"
xml << <<-EOS
<entry>
<batch:id>#{h(row)},#{h(col)}</batch:id>
<batch:operation type="update"/>
Expand All @@ -511,13 +511,11 @@ def save()
EOS

# close each batch out at 500 cells
current_cell++
batch_count++
current_cell +=1
batch_count += 1
end

xml << <<-"EOS"
</feed>
EOS
xml << "</feed>"

result = @session.post("#{@cells_feed_url}/batch", xml)
for entry in result.search("atom:entry")
Expand Down

0 comments on commit 28582df

Please sign in to comment.