Class: FileTransfer::Generic

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

Direct Known Subclasses

Ftp, Sftp

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Generic

Returns a new instance of Generic.



7
8
9
10
11
12
13
14
# File 'lib/file_transfer/generic.rb', line 7

def initialize(options = {})
  @host = options[:host] || 'localhost'
  @username = options[:username] || 'anonymous'
  @password = options[:password] || ''
  @keys = options[:keys].to_s.split(',') || []
  @port = options[:port] || 21
  @timeout_seconds = options[:timeout] || 300
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/file_transfer/generic.rb', line 5

def host
  @host
end

#keysObject

Returns the value of attribute keys.



5
6
7
# File 'lib/file_transfer/generic.rb', line 5

def keys
  @keys
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/file_transfer/generic.rb', line 5

def password
  @password
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/file_transfer/generic.rb', line 5

def port
  @port
end

#timeout_secondsObject

Returns the value of attribute timeout_seconds.



5
6
7
# File 'lib/file_transfer/generic.rb', line 5

def timeout_seconds
  @timeout_seconds
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/file_transfer/generic.rb', line 5

def username
  @username
end

Instance Method Details

#closeObject



31
32
# File 'lib/file_transfer/generic.rb', line 31

def close
end

#download(from_path, to_path) ⇒ Object



22
23
# File 'lib/file_transfer/generic.rb', line 22

def download(from_path, to_path)
end

#exist?(file_path) ⇒ Boolean

Returns:

  • (Boolean)


28
29
# File 'lib/file_transfer/generic.rb', line 28

def exist?(file_path)
end

#list(dir, filter = '') ⇒ Object



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

def list(dir, filter = '')
end

#move(file_name, from_dir, to_dir) ⇒ Object



25
26
# File 'lib/file_transfer/generic.rb', line 25

def move(file_name, from_dir, to_dir)
end

#to_sObject



34
35
36
# File 'lib/file_transfer/generic.rb', line 34

def to_s
  "FtpClient {@host => #{host},  @username => #{username}, @protocol => #{type}, @port => #{port}, @password => ***}"
end

#upload(from_path, to_path) ⇒ Object



19
20
# File 'lib/file_transfer/generic.rb', line 19

def upload(from_path, to_path)
end