Class: BillHicks::FTP

Inherits:
Object
  • Object
show all
Defined in:
lib/bill_hicks/ftp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ FTP

Returns a new instance of FTP.



6
7
8
9
10
# File 'lib/bill_hicks/ftp.rb', line 6

def initialize(credentials)
  @connection ||= Net::FTP.new(BillHicks.config.ftp_host)
  @connection.passive = true
  self.(credentials[:username], credentials[:password])
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/bill_hicks/ftp.rb', line 4

def connection
  @connection
end

Instance Method Details

#closeObject



18
19
20
# File 'lib/bill_hicks/ftp.rb', line 18

def close
  @connection.close
end

#login(username, password) ⇒ Object



12
13
14
15
16
# File 'lib/bill_hicks/ftp.rb', line 12

def (username, password)
  @connection.(username, password)
rescue Net::FTPPermError
  raise BillHicks::NotAuthenticated
end