Class: LeccaClient::Uploader
- Inherits:
-
Object
- Object
- LeccaClient::Uploader
- Defined in:
- lib/lecca_client/uploader.rb
Instance Method Summary collapse
-
#initialize(text, filename) ⇒ Uploader
constructor
A new instance of Uploader.
- #upload ⇒ Object
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
#upload ⇒ Object
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 |