Class: CarrierWave::Storage::UpYun
- Inherits:
-
Abstract
- Object
- Abstract
- CarrierWave::Storage::UpYun
- Defined in:
- lib/carrierwave/storage/upyun.rb
Overview
CarrierWave.configure do |config|
config.upyun_username = "xxxxxx"
config.upyun_password = "xxxxxx"
config.upyun_bucket = "my_bucket"
config.upyun_bucket_host = "https://my_bucket.files.example.com"
config.upyun_api_host = "http://v0.api.upyun.com"
end
Defined Under Namespace
Classes: ConcurrentUploadError, File, UploadError
Constant Summary collapse
- DEFAULT_API_URL =
"http://v0.api.upyun.com"
Instance Method Summary collapse
- #cache!(file) ⇒ Object
- #clean_cache!(seconds) ⇒ Object
- #delete_dir!(path) ⇒ Object
-
#retrieve!(identifier) ⇒ Object
Do something to retrieve the file.
- #retrieve_from_cache!(identifier) ⇒ Object
-
#store!(file) ⇒ Object
Store the file on UpYun.
Instance Method Details
#cache!(file) ⇒ Object
174 175 176 177 178 |
# File 'lib/carrierwave/storage/upyun.rb', line 174 def cache!(file) f = File.new(uploader, self, uploader.cache_path) f.store(file, "Content-Type" => file.content_type) f end |
#clean_cache!(seconds) ⇒ Object
186 |
# File 'lib/carrierwave/storage/upyun.rb', line 186 def clean_cache!(seconds); end |
#delete_dir!(path) ⇒ Object
184 |
# File 'lib/carrierwave/storage/upyun.rb', line 184 def delete_dir!(path); end |
#retrieve!(identifier) ⇒ Object
Do something to retrieve the file
- identifier (String)
-
uniquely identifies the file
Returns
- CarrierWave::Storage::UpYun::File
-
the stored file
170 171 172 |
# File 'lib/carrierwave/storage/upyun.rb', line 170 def retrieve!(identifier) File.new(uploader, self, uploader.store_path(identifier)) end |
#retrieve_from_cache!(identifier) ⇒ Object
180 181 182 |
# File 'lib/carrierwave/storage/upyun.rb', line 180 def retrieve_from_cache!(identifier) File.new(uploader, self, uploader.cache_path(identifier)) end |
#store!(file) ⇒ Object
Store the file on UpYun
Parameters
- file (CarrierWave::SanitizedFile)
-
the file to store
Returns
- CarrierWave::Storage::UpYun::File
-
the stored file
154 155 156 157 158 |
# File 'lib/carrierwave/storage/upyun.rb', line 154 def store!(file) f = File.new(uploader, self, uploader.store_path) f.store(file, "Content-Type" => file.content_type) f end |