Sha256: d10d06b05983b3f729e729b20a60b79ed5e5fe84495138b56235091436cea14f

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

module HylaFAX
  class Command
    DEFAULT_HOST     = '127.0.0.1'
    DEFAULT_PORT     = 4559
    DEFAULT_USER     = 'anonymous'
    DEFAULT_PASSWORD = 'anonymous'

    attr_reader :ftp, :host, :port, :user, :password

    def initialize(opts = {})
      @ftp      = opts.fetch(:ftp)      { Net::FTP.new }
      @host     = opts.fetch(:host)     { DEFAULT_HOST }
      @port     = opts.fetch(:port)     { DEFAULT_PORT }
      @user     = opts.fetch(:user)     { DEFAULT_USER }
      @password = opts.fetch(:password) { DEFAULT_PASSWORD }

      @ftp.passive = true if opts[:passive]
    end

    private

    def connect
      ftp.connect(host, port)
    end

    def login
      ftp.login(user, password)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hylafax-0.4.0 lib/hylafax/command.rb