def write(options_or_data = nil, options = nil)
(data_options, put_options) =
compute_put_options(options_or_data, options)
add_configured_write_options(put_options)
if use_multipart?(data_options, put_options)
put_options.delete(:multipart_threshold)
multipart_upload(put_options) do |upload|
each_part(data_options, put_options) do |part|
upload.add_part(part)
end
end
else
opts = { :bucket_name => bucket.name, :key => key }
resp = client.put_object(opts.merge(put_options).merge(data_options))
if resp.version_id
ObjectVersion.new(self, resp.version_id)
else
self
end
end
end