Class: S3AssetsDeployer::AwsS3

Inherits:
Object
  • Object
show all
Defined in:
lib/s3_assets_deployer/aws_s3.rb

Instance Method Summary collapse

Constructor Details

#initialize(bucket: nil, prefix_key: nil) ⇒ AwsS3

Returns a new instance of AwsS3.



5
6
7
8
# File 'lib/s3_assets_deployer/aws_s3.rb', line 5

def initialize(bucket: nil, prefix_key: nil)
  @bucket = bucket
  @prefix_key = prefix_key
end

Instance Method Details

#upload(files) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# 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