Method: Supermarket::API.profiles

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

.profilesObject

displays a list of profiles



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/bundles/inspec-supermarket/api.rb', line 16

def self.profiles
  url = "#{SUPERMARKET_URL}/api/v1/tools-search"
  _success, data = get(url, { q: 'compliance_profile' })
  if !data.nil?
    profiles = JSON.parse(data)
    profiles['items'].map { |x|
      m = %r{^#{Supermarket::API.supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool'])
      x['slug'] = m[:slug]
      x
    }
  else
    []
  end
end