Class: AssetsDeployer::Storage::AwsS3

Inherits:
Base
  • Object
show all
Defined in:
lib/assets_deployer/storage/aws_s3.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of AwsS3.



6
7
8
9
10
11
# File 'lib/assets_deployer/storage/aws_s3.rb', line 6

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

Instance Method Details

#upload(files) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/assets_deployer/storage/aws_s3.rb', line 13

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