Method: Supermarket::API.info

Defined in:
lib/bundles/inspec-supermarket/api.rb

.info(profile, supermarket_url = SUPERMARKET_URL) ⇒ Object

displays profile infos



38
39
40
41
42
43
44
45
46
47
# File 'lib/bundles/inspec-supermarket/api.rb', line 38

def self.info(profile, supermarket_url = SUPERMARKET_URL)
  _tool_owner, tool_name = profile_name("supermarket://#{profile}")
  return if tool_name.nil? || tool_name.empty?
  # Tool name in Supermarket URL is downcased so we need to downcase
  url = "#{supermarket_url}/api/v1/tools/#{tool_name.downcase}"
  _success, data = get(url, {})
  JSON.parse(data) if !data.nil?
rescue JSON::ParserError
  nil
end