Method: Supermarket::API.profiles
- Defined in:
- lib/bundles/inspec-supermarket/api.rb
.profiles(supermarket_url = SUPERMARKET_URL) ⇒ Object
displays a list of profiles
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bundles/inspec-supermarket/api.rb', line 14 def self.profiles(supermarket_url = SUPERMARKET_URL) url = "#{supermarket_url}/api/v1/tools-search" _success, data = get(url, { type: 'compliance_profile', items: 100 }) if !data.nil? profiles = JSON.parse(data) profiles['items'].map { |x| m = %r{^#{supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool']) x['slug'] = m[:slug] x } else [] end end |