Class: Threadfix::Client::Applications::Lookup

Inherits:
Object
  • Object
show all
Defined in:
lib/threadfix/client/applications/lookup.rb

Constant Summary collapse

API_VERSION =
'v2.5.0.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Lookup

Returns a new instance of Lookup.



9
10
11
12
# File 'lib/threadfix/client/applications/lookup.rb', line 9

def initialize(options={})
  @team_name = options[:team_name]
  @app_name = options[:app_name]
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



7
8
9
# File 'lib/threadfix/client/applications/lookup.rb', line 7

def app_name
  @app_name
end

#team_nameObject (readonly)

Returns the value of attribute team_name.



7
8
9
# File 'lib/threadfix/client/applications/lookup.rb', line 7

def team_name
  @team_name
end

Instance Method Details

#perform!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/threadfix/client/applications/lookup.rb', line 14

def perform!
  begin
    puts "GET #{endpoint.to_s}" if ENV['DEBUG']
    r = RestClient.get(
      endpoint.to_s,
      { :accept => "application/json", :Authorization => "APIKEY #{apiKey}" }
    )
    JSON.parse(r.body)
  rescue RestClient::NotFound => e
    puts "Endpoint not found (using API version: #{API_VERSION})"
    raise e
  rescue RestClient::ExceptionWithResponse => e
    raise e
  end
end