lib/google_apps/transport.rb in google_apps-0.3.4 vs lib/google_apps/transport.rb in google_apps-0.3.5
- old
+ new
@@ -89,11 +89,11 @@
doc.elements.each('entry/apps:property') do |property|
urls << property.attributes['value'] if property.attributes['name'].match 'fileUrl'
end
urls.each do |url|
- download(url, filename + "#{urls.index[url]}")
+ download(url, filename + "#{urls.index(url)}")
end
end
# download makes a get request of the provided url
# and writes the body to the provided filename.
@@ -102,10 +102,10 @@
def download(url, filename)
uri = URI(url)
@request = Net::HTTP::Get.new uri.path
set_headers :user
- File.new(filename, "w") do |file|
+ File.open(filename, "w") do |file|
file.puts request(uri).body
end
end
# get is a generic target for method_missing. It is
\ No newline at end of file