Class: Supermarket::API
- Inherits:
-
Object
- Object
- Supermarket::API
- Defined in:
- lib/bundles/inspec-supermarket/api.rb
Class Method Summary collapse
Class Method Details
.info(slug) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/bundles/inspec-supermarket/api.rb', line 26 def self.info(slug) url = "https://supermarket.chef.io/api/v1/tools/#{slug}" data = get(url, {}) if !data.nil? info = JSON.parse(data) else {} end end |
.profiles ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bundles/inspec-supermarket/api.rb', line 7 def self.profiles url = 'https://supermarket.chef.io/api/v1/tools-search' data = get(url, { :q => 'compliance_profile' }) if !data.nil? profiles = JSON.parse(data) profiles['items'] # val = [] # # iterate over profiles # profiles.each_key { |org| # profiles[org].each_key { |name| # val.push({ org: org, name: name}) # } # } # val else [] end end |