Class: Emarsys::Broadcast::SFTP

Inherits:
Object
  • Object
show all
Includes:
Validation
Defined in:
lib/emarsys/broadcast/sftp.rb

Instance Method Summary collapse

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