Class: Insup::Uploader
- Inherits:
-
Object
show all
- Includes:
- Observable
- Defined in:
- lib/insup/uploader.rb
Defined Under Namespace
Classes: DummyUploader, InsalesUploader
Constant Summary
collapse
- CREATING_FILE =
0
- CREATED_FILE =
1
- MODIFYING_FILE =
2
- MODIFIED_FILE =
3
- DELETING_FILE =
4
- DELETED_FILE =
5
- BATCH_UPLOADING_FILES =
6
- BATCH_UPLOADED_FILES =
7
- ERROR =
8
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config = nil) ⇒ Uploader
Returns a new instance of Uploader.
25
26
27
|
# File 'lib/insup/uploader.rb', line 25
def initialize config = nil
@config = config
end
|
Class Method Details
.find_uploader(uploader_alias) ⇒ Object
21
22
23
|
# File 'lib/insup/uploader.rb', line 21
def self.find_uploader(uploader_alias)
@@uploaders[uploader_alias.to_sym]
end
|
.uploader(uploader_alias) ⇒ Object
16
17
18
19
|
# File 'lib/insup/uploader.rb', line 16
def self.uploader(uploader_alias)
@@uploaders ||= {}
@@uploaders[uploader_alias] = self
end
|
Instance Method Details
#batch_upload(files) ⇒ Object
33
34
35
36
37
|
# File 'lib/insup/uploader.rb', line 33
def batch_upload(files)
files.each do |file|
upload_file(file)
end
end
|
#delete_file(file) ⇒ Object
31
|
# File 'lib/insup/uploader.rb', line 31
def delete_file(file); end
|
#process_file(file) ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/insup/uploader.rb', line 39
def process_file(file)
case file.state
when Insup::TrackedFile::DELETED
remove_file(file)
else
upload_file(file)
end
end
|
#upload_file(file) ⇒ Object
29
|
# File 'lib/insup/uploader.rb', line 29
def upload_file(file); end
|