class Artifactory::Resource::Certificate

def all(options = {})

Returns:
  • (Array) -

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

Parameters:
  • options (Hash) --
def all(options = {})
  client = extract_client!(options)
  client.get("/api/system/security/certificates").map do |cert|
    from_hash(cert, client: client)
  end.compact
end

def api_path

Returns:
  • (String) -
def api_path
  "/api/system/security/certificates/#{url_safe(certificate_alias)}"
end

def delete

Returns:
  • (Boolean) -
def delete
  client.delete(api_path)
  true
rescue Error::HTTPError
  false
end

def from_hash(hash, options = {})

Other tags:
    See: Artifactory::Resource::Base.from_hash -
def from_hash(hash, options = {})
  super.tap do |instance|
    instance.issued_on   = Time.parse(instance.issued_on)   rescue nil
    instance.valid_until = Time.parse(instance.valid_until) rescue nil
  end
end

def upload

Returns:
  • (Resource::Certificate) -

Other tags:
    Example: Upload a certificate from a File instance -
def upload
  file = File.new(File.expand_path(local_path))
  headers = { "Content-Type" => "application/text" }
  response = client.post(api_path, file, headers)
  return unless response.is_a?(Hash)
  self.class.all.select { |x| x.certificate_alias.eql?(certificate_alias) }.first
end