Class: FileTransfer::Sftp
Instance Attribute Summary
Attributes inherited from Generic
#host, #password, #port, #timeout_seconds, #username
Instance Method Summary
collapse
Methods inherited from Generic
#exist?, #list, #move, #to_s
Constructor Details
#initialize(options = {}) ⇒ Sftp
Returns a new instance of Sftp.
5
6
7
8
|
# File 'lib/file_transfer/sftp.rb', line 5
def initialize(options = {})
options[:port] ||= 22
super(options)
end
|
Instance Method Details
#close ⇒ Object
24
25
26
|
# File 'lib/file_transfer/sftp.rb', line 24
def close
end
|
#download(from_path, to_path) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/file_transfer/sftp.rb', line 10
def download(from_path, to_path)
connect if closed?
timeout(timeout_seconds) do
@sftp.download! from_path, to_path
end
end
|
#upload(from_path, to_path) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/file_transfer/sftp.rb', line 17
def upload(from_path, to_path)
connect if closed?
timeout(timeout_seconds) do
@sftp.upload! from_path, to_path
end
end
|