class S3AssetsDeployer::AwsS3

Public Class Methods

new(bucket: nil, prefix_key: nil) click to toggle source
# File lib/s3_assets_deployer/aws_s3.rb, line 5
def initialize(bucket: nil, prefix_key: nil)
  @bucket = bucket
  @prefix_key = prefix_key
end

Public Instance Methods

upload(files) click to toggle source
# File lib/s3_assets_deployer/aws_s3.rb, line 10
def upload(files)
  files.each do |file|
    client.put_object(
      bucket: @bucket,
      key: [@prefix_key, file.key].compact.join('/'),
      body: file.body,
      content_type: file.content_type
    )
  end
end

Private Instance Methods

client() click to toggle source
# File lib/s3_assets_deployer/aws_s3.rb, line 23
def client
  @client ||= Aws::S3::Client.new
end