Closed eriko closed 9 years ago
Here's a cobbled together bit of code. Untested, but at least you can compare :)
zipout = "myfile.zip"
files = ["users.csv"]
zip_file = Zip::File.open(zipout, Zip::File::CREATE) do |zip|
files.each do |path|
filename = File.basename(path)
zip.add(filename, path)
end
zip
end
payload = Faraday::UploadIO.new(zip_file, 'zip')
@pandarus.import_sis_data(@canvas_account_id, attachment: payload)
It maybe that switching over to the faraday uploadIO will do the trick. Thanks.
Is there any chance you have any sample code to bundling up the individual sis csv files into a zip. I have been trying to do it in memory using ruby zip with no success. The example only has one file as it is from the the tasks that updates faculty members. The same code using stringIO.new(data) and not the zip outputstream works. I can build the zip on the file system but I would like to avoid that.