Class: XFTP::Client Private

Inherits:
Object
  • Object
show all
Defined in:
lib/xftp/client.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The XFTP entry point

Constant Summary collapse

SCHEME_ADAPTERS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  ftp:  XFTP::Session::FTP,
  sftp: XFTP::Session::SFTP
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme_adapters) ⇒ Client

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Client.



17
18
19
# File 'lib/xftp/client.rb', line 17

def initialize(scheme_adapters)
  @scheme_adapters = scheme_adapters
end

Class Method Details

.start(url, settings, &callback) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/xftp/client.rb', line 13

def self.start(url, settings, &callback)
  new(SCHEME_ADAPTERS).call(url, settings, &callback)
end

Instance Method Details

#call(url, settings, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initiates a new session

See Also:

  • Validator::Settings


23
24
25
26
27
28
# File 'lib/xftp/client.rb', line 23

def call(url, settings, &block)
  uri = URI.parse(url)
  klass = adapter_class(uri.scheme)
  session = klass.new(uri, settings.deep_dup)
  session.start(&block)
end