Class: NexusAPI::Search
- Inherits:
-
Thor
- Object
- Thor
- NexusAPI::Search
- Includes:
- CLIUtils
- Defined in:
- lib/nexus_api/cli_commands/search.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
Methods included from CLIUtils
#if_file_exists?, #print_element, #print_paginating_set, #print_set, #repository_set?, #set, #setup
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
3 4 5 |
# File 'lib/nexus_api/cli_commands/search.rb', line 3 def api @api end |
Instance Method Details
#asset ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/nexus_api/cli_commands/search.rb', line 14 def asset setup results = Array.new.tap do |results| loop do results.concat( @api.search_asset( name: [:name], format: [:type], repository: [:repository], sha1: [:sha1], version: [:version], paginate: true, ) ) break unless @api.paginate? end end.select { |result| result['path'].include?([:name]) } puts [:full] ? results : results.map { |result| result['path'] } end |