Class: PuppetX::Bodeco::FTP
- Inherits:
-
Object
- Object
- PuppetX::Bodeco::FTP
- Defined in:
- lib/puppet_x/bodeco/util.rb
Instance Method Summary collapse
- #download(uri, file_path) ⇒ Object
-
#initialize(url, options) ⇒ FTP
constructor
A new instance of FTP.
Constructor Details
#initialize(url, options) ⇒ FTP
Returns a new instance of FTP.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/puppet_x/bodeco/util.rb', line 148 def initialize(url, ) require 'net/ftp' uri = URI(url) username = [:username] password = [:password] proxy_server = [:proxy_server] proxy_type = [:proxy_type] ENV["#{proxy_type}_proxy"] = proxy_server @ftp = Net::FTP.new @ftp.connect(uri.host, uri.port) if username @ftp.login(username, password) else @ftp.login end end |
Instance Method Details
#download(uri, file_path) ⇒ Object
168 169 170 |
# File 'lib/puppet_x/bodeco/util.rb', line 168 def download(uri, file_path) @ftp.getbinaryfile(uri.path, file_path) end |