Class: PgExport::FtpService::Connection
- Inherits:
-
Object
- Object
- PgExport::FtpService::Connection
- Includes:
- Logging
- Defined in:
- lib/pg_export/ftp_service/connection.rb
Instance Attribute Summary collapse
-
#ftp ⇒ Object
readonly
Returns the value of attribute ftp.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(host:, user:, password:) ⇒ Connection
constructor
A new instance of Connection.
- #open ⇒ Object
Methods included from Logging
Constructor Details
#initialize(host:, user:, password:) ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 |
# File 'lib/pg_export/ftp_service/connection.rb', line 8 def initialize(host:, user:, password:) @host, @user, @password = host, user, password open end |
Instance Attribute Details
#ftp ⇒ Object (readonly)
Returns the value of attribute ftp.
6 7 8 |
# File 'lib/pg_export/ftp_service/connection.rb', line 6 def ftp @ftp end |
Instance Method Details
#close ⇒ Object
20 21 22 23 24 |
# File 'lib/pg_export/ftp_service/connection.rb', line 20 def close @ftp.close logger.info 'Close FTP' self end |
#open ⇒ Object
13 14 15 16 17 18 |
# File 'lib/pg_export/ftp_service/connection.rb', line 13 def open @ftp = Net::FTP.new(host, user, password) @ftp.passive = true logger.info "Connect to #{host}" self end |