Class: LeccaClient::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/lecca_client/uploader.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, filename) ⇒ Uploader

Returns a new instance of Uploader.



5
6
7
8
# File 'lib/lecca_client/uploader.rb', line 5

def initialize(text, filename)
  @text = text
  @filename = filename
end

Instance Method Details

#uploadObject



10
11
12
13
14
15
16
# File 'lib/lecca_client/uploader.rb', line 10

def upload
  Net::SFTP.start(config[:host], config[:user], password: config[:pass]) do |sftp|
    sftp.file.open([config[:upload_path].to_s, @filename].join('/'), "w") do |file|
      file.puts @text
    end
  end
end