Class: CarrierWave::Storage::AWSOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/carrierwave/storage/aws_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uploader) ⇒ AWSOptions

Returns a new instance of AWSOptions.



8
9
10
# File 'lib/carrierwave/storage/aws_options.rb', line 8

def initialize(uploader)
  @uploader = uploader
end

Instance Attribute Details

#uploaderObject (readonly)

Returns the value of attribute uploader.



6
7
8
# File 'lib/carrierwave/storage/aws_options.rb', line 6

def uploader
  @uploader
end

Instance Method Details

#expiration_options(options = {}) ⇒ Object



24
25
26
27
28
# File 'lib/carrierwave/storage/aws_options.rb', line 24

def expiration_options(options = {})
  uploader_expiration = uploader.aws_authenticated_url_expiration

  { expires_in: uploader_expiration }.merge(options)
end

#read_optionsObject



12
13
14
# File 'lib/carrierwave/storage/aws_options.rb', line 12

def read_options
  aws_read_options
end

#write_options(new_file) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/carrierwave/storage/aws_options.rb', line 16

def write_options(new_file)
  {
    acl: uploader.aws_acl,
    body: new_file.to_file,
    content_type: new_file.content_type
  }.merge(aws_attributes).merge(aws_write_options)
end