Class: CarrierWave::Storage::UpYun

Inherits:
Abstract
  • Object
show all
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: Connection, 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::UpYun::File

the stored file

Parameters:

  • identifier (String)

    uniquely identifies the file



217
218
219
# File 'lib/carrierwave/storage/upyun.rb', line 217

def retrieve!(identifier)
  CarrierWave::Storage::UpYun::File.new(uploader, self, uploader.store_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



200
201
202
203
204
205
# File 'lib/carrierwave/storage/upyun.rb', line 200

def store!(file)
  cloud_files_options = {'Content-Type' => file.content_type}
  f = CarrierWave::Storage::UpYun::File.new(uploader, self, uploader.store_path)
  f.store(file.read,cloud_files_options)
  f
end