Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def upload
- puts "Uploading..."
- @input.each {|file_name|
- begin
- req = Net::HTTP::Post.new(@uri, 'Content-Type' => 'application/json')
- fi = File.open(@LOGS_DIR + "/" + file_name + "/20190128-214339.evtc", 'rb')
- req.body = {
- json: '1',
- rotation_weap1: '1',
- generator: 'ei',
- file: fi
- }.to_json
- res = Net::HTTP.start(@uri.hostname, @uri.port, use_ssl: true) do |https|
- https.request(req)
- end
- p "response: #{res.body}"
- fi.close
- rescue => e
- puts "Error during upload: #{e}"
- end
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement