Class: Zanders::Base

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

Direct Known Subclasses

Catalog, Inventory, SoapClient

Class Method Summary collapse

Class Method Details

.connect(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/zanders/base.rb', line 4

def self.connect(options = {})
  requires!(options, :username, :password)

  Net::FTP.open(Zanders.config.ftp_host, options[:username], options[:password]) do |ftp|
    ftp.debug_mode = Zanders.config.debug_mode
    ftp.passive = true

    yield ftp
  end
rescue Net::FTPPermError
  raise Zanders::NotAuthenticated
end