Class: CarrierWave::Storage::UCloud

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

Overview

CarrierWave.configure do |config|

  config.public_key = "xxxxxx"
  config.private_key = "xxxxxx"
  config.ucloud_bucket = "my_bucket"
  config.ucloud_bucket_host = "https://my_bucket.files.example.com"
  config.ucloud_cdn_host = "https://my_bucket.files.example.com"
end

Defined Under Namespace

Classes: File

Instance Method Summary collapse

Instance Method Details

#retrieve!(identifier) ⇒ Object

Do something to retrieve the file

identifier (String)

uniquely identifies the file

Returns

CarrierWave::Storage::UCloud::File

the stored file

Parameters:

  • identifier (String)

    uniquely identifies the file



149
150
151
# File 'lib/carrierwave/storage/ucloud.rb', line 149

def retrieve!(identifier)
  File.new(uploader, self, uploader.store_path(identifier))
end

#store!(file) ⇒ Object

Store the file on UCloud

Parameters

file (CarrierWave::SanitizedFile)

the file to store

Returns

CarrierWave::Storage::UCloud::File

the stored file



133
134
135
136
137
# File 'lib/carrierwave/storage/ucloud.rb', line 133

def store!(file)
  f = File.new(uploader, self, uploader.store_path)
  f.store(file.read, 'Content-Type' => file.content_type)
  f
end