class NexusAPI::Search

Attributes

api[RW]

Public Instance Methods

asset() click to toggle source
# 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:       options[:name],
          format:     options[:type],
          repository: options[:repository],
          sha1:       options[:sha1],
          version:    options[:version],
          paginate:   true,
        )
      )
      break unless @api.paginate?
    end
  end.select { |result| result['path'].include?(options[:name]) }
  puts options[:full] ? results : results.map { |result| result['path'] }
end