class Stockboy::Providers::FTP::FTPAdapter
Attributes
client[R]
Public Class Methods
exception_class()
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 46 def self.exception_class Net::FTPError end
new(provider)
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 7 def initialize(provider) @provider = provider end
Public Instance Methods
chdir(directory)
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 22 def chdir(directory) client.chdir directory end
delete(file_name)
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 30 def delete(file_name) client.delete file_name end
download(file_name)
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 34 def download(file_name) client.get(file_name, nil) end
list_files()
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 26 def list_files client.nlst.sort end
modification_time(file_name)
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 38 def modification_time(file_name) client.mtime file_name end
open() { |self| ... }
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 11 def open result = nil Net::FTP.open(@provider.host, @provider.username, @provider.password) do |ftp| @client = ftp client.binary = @provider.binary client.passive = @provider.passive result = yield self end result end
size(file_name)
click to toggle source
# File lib/stockboy/providers/ftp/ftp_adapter.rb, line 42 def size(file_name) client.size file_name end