Class: CarrierWave::Storage::CloudFiles
- Defined in:
- lib/carrierwave/storage/cloud_files.rb
Overview
Uploads things to Rackspace Cloud Files webservices using the Rackspace libraries (cloudfiles gem). In order for CarrierWave to connect to Cloud Files, you’ll need to specify an username, api key and container
CarrierWave.configure do |config|
config.cloud_files_username = "xxxxxx"
config.cloud_files_api_key = "xxxxxx"
config.cloud_files_container = "my_container"
end
You can optionally include your CDN host name in the configuration. This is highly recommended, as without it every request requires a lookup of this information.
config.cloud_files_cdn_host = "c000000.cdn.rackspacecloud.com"
Defined Under Namespace
Classes: File
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#retrieve!(identifier) ⇒ Object
Do something to retrieve the file.
-
#store!(file) ⇒ Object
Store the file on Cloud Files.
Methods inherited from Abstract
Constructor Details
This class inherits a constructor from CarrierWave::Storage::Abstract
Instance Method Details
#retrieve!(identifier) ⇒ Object
Do something to retrieve the file
- identifier (String)
-
uniquely identifies the file
Returns
- CarrierWave::Storage::CloudFiles::File
-
the stored file
161 162 163 |
# File 'lib/carrierwave/storage/cloud_files.rb', line 161 def retrieve!(identifier) CarrierWave::Storage::CloudFiles::File.new(uploader, self, uploader.store_path(identifier)) end |
#store!(file) ⇒ Object
Store the file on Cloud Files
Parameters
- file (CarrierWave::SanitizedFile)
-
the file to store
Returns
- CarrierWave::Storage::CloudFiles::File
-
the stored file
144 145 146 147 148 149 |
# File 'lib/carrierwave/storage/cloud_files.rb', line 144 def store!(file) = {'Content-Type' => file.content_type} f = CarrierWave::Storage::CloudFiles::File.new(uploader, self, uploader.store_path) f.store(file.read,) f end |