Module: FileFM
- Defined in:
- lib/filefm.rb,
lib/filefm/config.rb,
lib/filefm/uploaders/swift.rb,
lib/filefm/downloaders/http.rb,
lib/filefm/downloaders/swift.rb,
lib/filefm/streaming_uploader.rb,
lib/filefm/uploaders/cloudfiles.rb,
lib/filefm/downloaders/cloudfiles.rb
Defined Under Namespace
Modules: Downloaders, Uploaders
Classes: Config, StreamingUploader, StreamingUploaderMultipart
Constant Summary
collapse
- Log =
Logger.new($stdout)
- VERSION =
"0.1.1"
Class Method Summary
collapse
Class Method Details
.download(link, opts = {}) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/filefm.rb', line 25
def self.download(link, opts={})
uri = URI.parse link
if uri.scheme =~ /^http/
require 'filefm/downloaders/http'
FileFM::Downloaders::HTTP.download link, opts
elsif uri.scheme =~ /^swift/
require 'filefm/downloaders/swift'
FileFM::Downloaders::Swift.download link, opts
elsif uri.scheme =~ /^cloudfiles/
require 'filefm/downloaders/cloudfiles'
FileFM::Downloaders::Cloudfiles.download link, opts
end
end
|
.upload(source, destination, options = {}) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/filefm.rb', line 40
def self.upload(source, destination, options = {})
uri = URI.parse destination
if uri.scheme =~ /^swift/
uri = URI.parse(destination)
require 'filefm/uploaders/swift'
FileFM::Uploaders::Swift.upload source, destination, options
elsif uri.scheme =~ /^cloudfiles/
require 'filefm/uploaders/cloudfiles'
FileFM::Uploaders::Cloudfiles.upload source, destination, options
end
end
|