lib/io_streams/s3/writer.rb in iostreams-0.16.2 vs lib/io_streams/s3/writer.rb in iostreams-0.17.0

- old
+ new

@@ -1,13 +1,15 @@ module IOStreams module S3 class Writer # Write to AWS S3 - def self.open(uri = nil, bucket: nil, region: nil, key: nil, &block) - options = uri.nil? ? args : parse_uri(uri).merge(args) + def self.open(uri, region: nil, **args, &block) + raise(ArgumentError, 'file_name must be a URI string') unless uri.is_a?(String) + + options = IOStreams::S3.parse_uri(uri) s3 = region.nil? ? Aws::S3::Resource.new : Aws::S3::Resource.new(region: region) object = s3.bucket(options[:bucket]).object(options[:key]) - object.upload_stream(file_name_or_io, &block) + object.upload_stream(args, &block) end end end end