Class: Threadfix::Cli::Scan

Inherits:
Thor
  • Object
show all
Defined in:
lib/threadfix/cli/scan.rb

Instance Method Summary collapse

Instance Method Details

#uploadObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/threadfix/cli/scan.rb', line 10

def upload
  Client.configure do |config|
    config.host = options[:host] if options[:host]
    config.key = options[:key] if options[:key]
  end

  begin
    response =  Client::Scans.upload(file_path: options[:file], app_id: options[:app_id] )
    message = response['message']
    message = message + " (ID: #{response['object']['id']})" if response['object'] && response['object']['id']

    puts message
  rescue Errno::ENOENT => e
    puts "Error: File or directory '#{options[:file]}' doesn't exist."
    exit 1
  rescue SocketError => e
    puts "Error: Unable open connection to '#{Client.config.host}'"
    exit 1
  end
end