class Artifactory::Resource::BuildComponent

def all(options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :client (Artifactory::Client) --

Parameters:
  • options (Hash) --
def all(options = {})
  client = extract_client!(options)
  client.get("/api/build")["builds"].map do |component|
    from_hash(component, client: client)
  end.compact.flatten
rescue Error::HTTPError => e
  # Artifactory returns a 404 instead of an empty list when there are no
  # builds. Whoever decided that was a good idea clearly doesn't
  # understand the point of REST interfaces...
  raise unless e.code == 404
  []
end

def api_path

Returns:
  • (String) -
def api_path
  "/api/build/#{url_safe(name)}"
end

def builds

Returns:
  • (Collection::Build) -

Other tags:
    Example: Get the list of artifacts for a repository -
def builds
  @builds ||= Collection::Build.new(self, name: name) do
    Resource::Build.all(name)
  end
end

def delete(options = {})

Returns:
  • (Boolean) -

Options Hash: (**options)
  • :delete_all (Boolean) --
  • :artifacts (Boolean) --
  • :build_numbers (Array) --
def delete(options = {})
  params = {}.tap do |param|
    param[:buildNumbers] = options[:build_numbers].join(",") if options[:build_numbers]
    param[:artifacts]    = 1 if options[:artifacts]
    param[:deleteAll]    = 1 if options[:delete_all]
  end
  endpoint = api_path + "?#{to_query_string_parameters(params)}"
  client.delete(endpoint, {})
  true
rescue Error::HTTPError => e
  false
end

def find(name, options = {})

Returns:
  • (Resource::BuildComponent, nil) -

Options Hash: (**options)
  • :client (Artifactory::Client) --

Parameters:
  • options (Hash) --
  • name (String) --

Other tags:
    Example: Find a particular build component -
def find(name, options = {})
  client = extract_client!(options)
  all.find do |component|
    component.name == name
  end
end

def from_hash(hash, options = {})

Other tags:
    See: Artifactory::Resource::Base.from_hash -
def from_hash(hash, options = {})
  super.tap do |instance|
    # Remove the leading / from the `uri` value. Converts `/foo` to `foo`.
    instance.name = instance.uri.slice(1..-1)
    instance.last_started = Time.parse(instance.last_started) rescue nil
  end
end

def rename(new_name, options = {})

Returns:
  • (Boolean) -

Parameters:
  • new_name (String) --
def rename(new_name, options = {})
  endpoint = "/api/build/rename/#{url_safe(name)}" + "?to=#{new_name}"
  client.post(endpoint, {})
  true
rescue Error::HTTPError => e
  false
end