Class: Threadfix::Cli::Applications

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

Instance Method Summary collapse

Instance Method Details

#get_idObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/threadfix/cli/applications.rb', line 9

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

  begin
    response =  Client::Applications.get_id(app_name: options[:app_name] )
    if !response.nil?
      puts response
    end
  rescue SocketError => e
    puts "Error: Unable open connection to '#{Client.config.host}'"
    exit 1
  end
end

#lookupObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/threadfix/cli/applications.rb', line 31

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

  begin
    response =  Client::Applications.lookup(team_name: options[:team_name], app_name: options[:app_name] )
    if response['message'] == ''
      puts "ID: #{response['object']['id']}"
    else
      puts response['message']
    end
  rescue SocketError => e
    puts "Error: Unable open connection to '#{Client.config.host}'"
    exit 1
  end
end