class SecEdgar::FtpClient
Public Class Methods
new()
click to toggle source
# File lib/sec_edgar/ftp_client.rb, line 5 def initialize @ftp = Net::FTP.new @ftp.passive = true connect login at_exit do puts "Closing SecEdgar::FtpClient..." @ftp.close end end
Public Instance Methods
connect()
click to toggle source
# File lib/sec_edgar/ftp_client.rb, line 21 def connect @ftp.connect('ftp.sec.gov', 21) rescue => e puts "SecEdgar::FtpClient connection failed" puts e.message end
fetch(remote_url, local_url)
click to toggle source
# File lib/sec_edgar/ftp_client.rb, line 17 def fetch(remote_url, local_url) @ftp.getbinaryfile(remote_url, local_url) end
login()
click to toggle source
# File lib/sec_edgar/ftp_client.rb, line 28 def login @ftp.login rescue => e puts "SecEdgar::FtpClient login failed" puts e.message end