Class: FileTransfer::Sftp

Inherits:
Generic
  • Object
show all
Defined in:
lib/file_transfer/sftp.rb

Instance Attribute Summary

Attributes inherited from Generic

#host, #password, #port, #username

Instance Method Summary collapse

Methods inherited from Generic

#close, #exist?, #list, #move

Constructor Details

#initialize(options = {}) ⇒ Sftp

Returns a new instance of Sftp.



5
6
7
8
9
# File 'lib/file_transfer/sftp.rb', line 5

def initialize(options = {})
  options[:port] ||= 22
  super(options)
  connect
end

Instance Method Details

#download(from_path, to_path) ⇒ Object



11
12
13
# File 'lib/file_transfer/sftp.rb', line 11

def download(from_path, to_path)
  @sftp.download! from_path, to_path
end

#upload(from_path, to_path) ⇒ Object



15
16
17
# File 'lib/file_transfer/sftp.rb', line 15

def upload(from_path, to_path)
  @sftp.upload! from_path, to_path
end