lib/s3_wrapper.rb in aws_client-0.0.5 vs lib/s3_wrapper.rb in aws_client-0.0.6

- old
+ new

@@ -21,17 +21,28 @@ def find_bucket_by(bucket_name) buckets.select{|bucket| bucket.name == bucket_name }.first end - def write_file_to_bucket(bucket_prefix_code, file_path) - bucket = find_or_create_bucket_for(bucket_prefix_code) + def write_to_bucket(bucket, file_path) s3_object = bucket.put_object( :key => File.basename(file_path), :body => IO.read(file_path) ) puts "\nRemote file" puts "#{s3_object.public_url}" + return s3_object + end + + def write_file_to_bucket(bucket_prefix_code, file_path) + bucket = find_or_create_bucket_for(bucket_prefix_code) + s3_object = write_to_bucket(bucket, file_path) + return s3_object + end + + def write_file_to_explicit_bucket_name(full_bucket_name, file_path) + bucket = find_or_create_bucket(full_bucket_name) + s3_object = write_to_bucket(bucket, file_path) return s3_object end def buckets return resource.buckets