Skip to content

Commit

Permalink
update supermarket profile search to use new type param
Browse files Browse the repository at this point in the history
Reverts the work-around that pulls down the latest 100 tools
and filters for type == 'compliance_profile' in the client.

Go back to using tool-search with the new type parameter.

Omit start:0 because that's the default.

Keep the number of items returned at 100, which is more than the
default 10.

Signed-off-by: Robb Kidd <robb@thekidds.org>
  • Loading branch information
robbkidd committed Nov 10, 2016
1 parent 824a8f7 commit 09a5e3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/bundles/inspec-supermarket/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class API

# displays a list of profiles
def self.profiles(supermarket_url = SUPERMARKET_URL)
url = "#{supermarket_url}/api/v1/tools"
_success, data = get(url, { start: 0, items: 100, order: 'recently_added' })
url = "#{supermarket_url}/api/v1/tools-search"
_success, data = get(url, { type: 'compliance_profile', items: 100, order: 'recently_added' })
if !data.nil?
profiles = JSON.parse(data)
profiles['items'].select { |p| p['tool_type'] == 'compliance_profile' }.map { |x|
profiles['items'].map { |x|
m = %r{^#{supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool'])
x['slug'] = m[:slug]
x
Expand Down

0 comments on commit 09a5e3f

Please sign in to comment.