Sha256: 409593f2fb964b4241cf41f148d0b29699ba69ccc1efdd7c9c5eb7b90ec05e71
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
# frozen_string_literal: true require "faraday" module CarrierWave module Storage ## # # 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 # # class UpYun < Abstract DEFAULT_API_URL = "http://v0.api.upyun.com" class UploadError < RuntimeError; end class ConcurrentUploadError < RuntimeError; end ## # Store the file on UpYun # # === Parameters # # [file (CarrierWave::SanitizedFile)] the file to store # # === Returns # # [CarrierWave::Storage::UpYun::File] the stored file # def store!(file) f = File.new(uploader, self, uploader.store_path) f.store(file, "Content-Type" => file.content_type) f end # Do something to retrieve the file # # @param [String] identifier uniquely identifies the file # # [identifier (String)] uniquely identifies the file # # === Returns # # [CarrierWave::Storage::UpYun::File] the stored file # def retrieve!(identifier) File.new(uploader, self, uploader.store_path(identifier)) end def cache!(file) f = File.new(uploader, self, uploader.cache_path) f.store(file, "Content-Type" => file.content_type) f end def retrieve_from_cache!(identifier) File.new(uploader, self, uploader.cache_path(identifier)) end def delete_dir!(path) end def clean_cache!(seconds) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carrierwave-upyun-2.0.0 | lib/carrierwave/storage/upyun.rb |