Class: CarrierWave::Storage::UpYun

Inherits:
Abstract
  • Object
show all
Defined in:
lib/carrierwave/storage/upyun.rb,
lib/carrierwave/storage/upyun/file.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

Instance Method Details

#cache!(file) ⇒ Object



55
56
57
58
59
# File 'lib/carrierwave/storage/upyun.rb', line 55

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



67
# File 'lib/carrierwave/storage/upyun.rb', line 67

def clean_cache!(seconds); end

#delete_dir!(path) ⇒ Object



65
# File 'lib/carrierwave/storage/upyun.rb', line 65

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

Parameters:

  • identifier (String)

    uniquely identifies the file



51
52
53
# File 'lib/carrierwave/storage/upyun.rb', line 51

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

#retrieve_from_cache!(identifier) ⇒ Object



61
62
63
# File 'lib/carrierwave/storage/upyun.rb', line 61

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



35
36
37
38
39
# File 'lib/carrierwave/storage/upyun.rb', line 35

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