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.
Methods inherited from Remi::Loader
Constructor Details
#initialize(*args, **kargs, &block) ⇒ SftpFile
Returns a new instance of SftpFile.
148 149 150 151 |
# File 'lib/remi/data_subjects/sftp_file.rb', line 148 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.
153 154 155 |
# File 'lib/remi/data_subjects/sftp_file.rb', line 153 def remote_path @remote_path end |
Instance Method Details
#load(data) ⇒ true
Copies data to the SFTP Server
158 159 160 161 162 163 164 165 |
# File 'lib/remi/data_subjects/sftp_file.rb', line 158 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 |