Class: BillHicks::Base

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

Direct Known Subclasses

Catalog, Category, Inventory, Order, ResponseFile, User

Class Method Summary collapse

Class Method Details

.connect(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# 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|
    ftp.debug_mode = BillHicks.config.debug_mode
    ftp.passive = true
    yield ftp
  end
rescue Net::FTPPermError
  raise BillHicks::NotAuthenticated
end