Class: Photocopier::FTP

Inherits:
Adapter show all
Defined in:
lib/photocopier/ftp.rb

Instance Attribute Summary

Attributes inherited from Adapter

#logger

Instance Method Summary collapse

Methods inherited from Adapter

#put

Constructor Details

#initialize(options = {}) ⇒ FTP

Returns a new instance of FTP.



3
4
5
# File 'lib/photocopier/ftp.rb', line 3

def initialize(options = {})
  @options = options
end

Instance Method Details

#delete(remote_path) ⇒ Object



19
20
21
# File 'lib/photocopier/ftp.rb', line 19

def delete(remote_path)
  session.delete(remote_path)
end

#get(remote_path, file_path = nil) ⇒ Object



11
12
13
# File 'lib/photocopier/ftp.rb', line 11

def get(remote_path, file_path = nil)
  session.get remote_path, file_path
end

#get_directory(remote_path, local_path, exclude = []) ⇒ Object



23
24
25
26
# File 'lib/photocopier/ftp.rb', line 23

def get_directory(remote_path, local_path, exclude = [])
  FileUtils.mkdir_p(local_path)
  lftp(local_path, remote_path, false, exclude)
end

#optionsObject



7
8
9
# File 'lib/photocopier/ftp.rb', line 7

def options
  @options.clone
end

#put_directory(local_path, remote_path, exclude = []) ⇒ Object



28
29
30
# File 'lib/photocopier/ftp.rb', line 28

def put_directory(local_path, remote_path, exclude = [])
  lftp(local_path, remote_path, true, exclude)
end

#put_file(file_path, remote_path) ⇒ Object



15
16
17
# File 'lib/photocopier/ftp.rb', line 15

def put_file(file_path, remote_path)
  session.put file_path, remote_path
end