Class: Megar::Files
- Inherits:
-
Object
- Object
- Megar::Files
- Includes:
- CatalogItem
- Defined in:
- lib/megar/catalog/files.rb
Overview
Collection manager for files
Instance Attribute Summary
Attributes included from CatalogItem
#id, #key, #name, #parent_folder_id, #payload, #session, #type
Instance Method Summary collapse
-
#create(attributes) ⇒ Object
Command: creates a new file given
attributes
which contains the following elements: body: the file body.
Methods included from CatalogItem
#==, #[], #add, #attributes=, #collection, #each, #find_all_by_parent_folder_id, #find_all_by_type, #find_by_id, #find_by_name, #find_by_type, #initialize, #parent_folder, #reset!, #resource_class
Instance Method Details
#create(attributes) ⇒ Object
Command: creates a new file given attributes
which contains the following elements:
body: the file body. May be a Pathname, File, or filename (String)
name: the file name to assign (optional if already available from the body object)
The file is stored in the parent folder (or root folder by defult)
10 11 12 13 14 |
# File 'lib/megar/catalog/files.rb', line 10 def create(attributes) if uploader = self.uploader(attributes) uploader.post! end end |