lib/io_streams/paths/s3.rb in iostreams-1.1.0 vs lib/io_streams/paths/s3.rb in iostreams-1.1.1

- old
+ new

@@ -129,17 +129,17 @@ # The date and time when you want this object's object lock to expire. # # @option params [String] :object_lock_legal_hold_status # The Legal Hold status that you want to apply to the specified object. def initialize(url, client: nil, access_key_id: nil, secret_access_key: nil, **args) - Utils.load_soft_dependency('aws-sdk-s3', 'AWS S3') unless defined?(::Aws::S3::Client) + Utils.load_soft_dependency("aws-sdk-s3", "AWS S3") unless defined?(::Aws::S3::Client) uri = Utils::URI.new(url) - raise "Invalid URI. Required Format: 's3://<bucket_name>/<key>'" unless uri.scheme == 's3' + raise "Invalid URI. Required Format: 's3://<bucket_name>/<key>'" unless uri.scheme == "s3" @bucket_name = uri.hostname - key = uri.path.sub(%r{\A/}, '') + key = uri.path.sub(%r{\A/}, "") if client.is_a?(Hash) client[:access_key_id] = access_key_id if access_key_id client[:secret_access_key] = secret_access_key if secret_access_key @client = ::Aws::S3::Client.new(client) else @@ -217,11 +217,11 @@ end end # Shortcut method if caller has a filename already with no other streams applied: def read_file(file_name) - ::File.open(file_name, 'wb') do |file| + ::File.open(file_name, "wb") do |file| client.get_object(@options.merge(response_target: file, bucket: bucket_name, key: path)) end end # Write to AWS S3 @@ -248,11 +248,11 @@ # Use multipart file upload s3 = Aws::S3::Resource.new(client: client) obj = s3.bucket(bucket_name).object(path) obj.upload_file(file_name) else - ::File.open(file_name, 'rb') do |file| + ::File.open(file_name, "rb") do |file| client.put_object(@options.merge(bucket: bucket_name, key: path, body: file)) end end end @@ -265,10 +265,10 @@ if matcher.pattern.nil? yield(matcher.path) if matcher.path.exist? return end - prefix = Utils::URI.new(matcher.path.to_s).path.sub(%r{\A/}, '') + prefix = Utils::URI.new(matcher.path.to_s).path.sub(%r{\A/}, "") token = nil loop do # Fetches upto 1,000 entries at a time resp = client.list_objects_v2(bucket: bucket_name, prefix: prefix, continuation_token: token) resp.contents.each do |object|