Class: BillHicks::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/bill_hicks/base.rb
Class Method Summary
collapse
Class Method Details
.connect(options = {}) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/bill_hicks/base.rb', line 4
def self.connect(options = {})
requires!(options, :username, :password)
Net::FTP.open(BillHicks.config.ftp_host, options[:username], options[:password]) do |ftp|
begin
ftp.debug_mode = BillHicks.config.debug_mode
ftp.passive = true
yield ftp
ensure
ftp.close
end
end
rescue Net::FTPPermError
raise BillHicks::NotAuthenticated
end
|