class Artifactory::Resource::User

def all(options = {})

Returns:
  • (Array) -

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

Parameters:
  • options (Hash) --
def all(options = {})
  client = extract_client!(options)
  client.get("/api/security/users").map do |hash|
    from_url(hash["uri"], client: client)
  end
end

def api_path

Returns:
  • (String) -
def api_path
  @api_path ||= "/api/security/users/#{url_safe(name)}"
end

def delete

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

def find(name, options = {})

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

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

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

Other tags:
    Example: Find a user by its name -
def find(name, options = {})
  client = extract_client!(options)
  response = client.get("/api/security/users/#{url_safe(name)}")
  from_hash(response, client: client)
rescue Error::HTTPError => e
  raise unless e.code == 404
  nil
end

def headers

Returns:
  • (Hash) -
def headers
  @headers ||= {
    "Content-Type" => "application/vnd.org.jfrog.artifactory.security.User+json",
  }
end

def save

Returns:
  • (Boolean) -
def save
  if self.class.find(name, client: client)
    client.post(api_path, to_json, headers)
  else
    client.put(api_path, to_json, headers)
  end
  true
end