class Hachi::Clients::User

Public Instance Methods

create(login:, name:, roles:, password:) click to toggle source

Create a user

@param [String] login @param [String] name @param [Array<String>] roles @param [String] password

@return [Hash]

# File lib/hachi/clients/user.rb, line 47
def create(login:, name:, roles:, password:)
  user = Models::User.new(
    login: login,
    name: name,
    roles: roles,
    password: password
  )

  post("/api/user", json: user.payload) { |json| json }
end
current() click to toggle source

Get current user

@return [Hash]

# File lib/hachi/clients/user.rb, line 11
def current
  get("/api/user/current") { |json| json }
end
delete_by_id(id) click to toggle source

Delete a user

@param [String] id User ID

@return [String]

# File lib/hachi/clients/user.rb, line 33
def delete_by_id(id)
  delete("/api/user/#{id}") { |json| json }
end
get_by_id(id) click to toggle source

Get a user

@param [String] id User ID

@return [Hash]

# File lib/hachi/clients/user.rb, line 22
def get_by_id(id)
  get("/api/user/#{id}") { |json| json }
end