Sha256: 7efe4ba84782b0fceb6fd2dec352e8cb436638cf0253b6a649119d6e7cad883b
Contents?: true
Size: 988 Bytes
Versions: 3
Compression:
Stored size: 988 Bytes
Contents
class FilesController < MVCLI::Controller requires :containers requires :command def index container.all end def create template = Files::CreateForm argv = MVCLI::Argv.new command.argv form = template.new argv.options form.validate! options = { :key => params[:id], :body => form.file.to_s } container.create options end def show file end def destroy file.destroy end def download template = Files::DownloadForm argv = MVCLI::Argv.new command.argv form = template.new argv.options form.validate! File.open(form.destination.to_s, 'w') do | f | container.get(params[:id]) do | data, remaining, content_length | f.syswrite data end end end private def container containers.find{|c| c.key == params[:container_id]}.files or fail Fog::Errors::NotFound end def file container.find{|f| f.key == params[:id]} or fail Fog::Errors::NotFound end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rumm-0.1.0 | app/controllers/files_controller.rb |
rumm-0.0.24 | app/controllers/files_controller.rb |
rumm-0.0.23 | app/controllers/files_controller.rb |