Class: Emarsys::Broadcast::SFTP
- Inherits:
-
Object
- Object
- Emarsys::Broadcast::SFTP
- Includes:
- Validation
- Defined in:
- lib/emarsys/broadcast/sftp.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ SFTP
constructor
A new instance of SFTP.
- #upload_file(local_path, remote_path) ⇒ Object
Methods included from Validation
#string_present?, #within_range?
Constructor Details
#initialize(config) ⇒ SFTP
Returns a new instance of SFTP.
7 8 9 10 |
# File 'lib/emarsys/broadcast/sftp.rb', line 7 def initialize(config) validate_config config @config = config end |
Instance Method Details
#upload_file(local_path, remote_path) ⇒ Object
12 13 14 15 16 |
# File 'lib/emarsys/broadcast/sftp.rb', line 12 def upload_file(local_path, remote_path) Net::SFTP.start(@config.sftp_host, @config.sftp_user, password: @config.sftp_password) do |sftp| sftp.upload!(local_path, remote_path) end end |