class Artifactory::Resource::Artifact

def latest_version(options = {})

Returns:
  • (String, nil) -

Options Hash: (**options)
  • :repos (String, Array) --
  • :remote (Boolean) --
  • :version (String) --
  • :name (String) --
  • :group (String) --
  • :client (Artifactory::Client) --

Parameters:
  • options (Hash) --

Other tags:
    Example: Find the latest version of an artifact in a group -
    Example: Find the latest snapshot version of an artifact -
    Example: Find the latest version of an artifact in a repo -
    Example: Find the latest version of an artifact -
def latest_version(options = {})
  client = extract_client!(options)
  options = Util.rename_keys(options,
    :group   => :g,
    :name    => :a,
    :version => :v,
  )
  params = Util.slice(options, :g, :a, :v, :repos, :remote)
  format_repos!(params)
  # For whatever reason, Artifactory won't accept "true" - they want a
  # literal "1"...
  params[:remote] = 1 if options[:remote]
  client.get('/api/search/latestVersion', params)
rescue Error::HTTPError => e
  raise unless e.code == 404
  nil
end