Class: Remi::Loader::SftpFile
- Inherits:
-
Remi::Loader
- Object
- Remi::Loader
- Remi::Loader::SftpFile
- Defined in:
- lib/remi/data_subjects/sftp_file.rb
Overview
SFTP file loader
Instance Attribute Summary collapse
-
#remote_path ⇒ Object
readonly
Returns the value of attribute remote_path.
Attributes inherited from Remi::Loader
Instance Method Summary collapse
-
#initialize(*args, **kargs, &block) ⇒ SftpFile
constructor
A new instance of SftpFile.
-
#load(data) ⇒ true
Copies data to the SFTP Server.
Constructor Details
#initialize(*args, **kargs, &block) ⇒ SftpFile
Returns a new instance of SftpFile.
147 148 149 150 |
# File 'lib/remi/data_subjects/sftp_file.rb', line 147 def initialize(*args, **kargs, &block) super init_sftp_loader(*args, **kargs, &block) end |
Instance Attribute Details
#remote_path ⇒ Object (readonly)
Returns the value of attribute remote_path.
152 153 154 |
# File 'lib/remi/data_subjects/sftp_file.rb', line 152 def remote_path @remote_path end |
Instance Method Details
#load(data) ⇒ true
Copies data to the SFTP Server
157 158 159 160 161 162 163 164 |
# File 'lib/remi/data_subjects/sftp_file.rb', line 157 def load(data) logger.info "Uploading #{data} to #{@credentials[:username]}@#{@credentials[:host]}: #{@remote_path}" connection do |sftp| retry_upload { sftp.upload! data, @remote_path } end true end |