Gitlab::Client::User
Defines methods related to users.
Instance methods
Creates a new email for a user.
- params [Int32] user_id The ID of a user.
- params [String] email Email address
- return [JSON::Any]
client.add_email('email@example.com', 2)
Creates a new email for current user.
- params [String] email Email address
- return [JSON::Any]
client.add_email('email@example.com')
Blocks the specified user.
Available only for admin.
- param [Int32] user_id The Id of user
- return [JSON::Any] success or not
client.block_user(4)
Creates a new SSH key for a user.
- param [Int32] user_id The Id of user.
- param [String] key The SSH key body.
- return [JSON::Any] Information about created SSH key.
client.create_ssh_key(2, "key title", "key body")
Creates a new SSH key for current user.
- param [String] title The title of an SSH key.
- param [String] key The SSH key body.
- return [JSON::Any] Information about created SSH key.
client.create_ssh_key("key title", "key body")
Creates a new user. Requires authentication from an admin account.
- param [String] email The email of a user.
- param [String] password The password of a user.
- param [String] username The username of a user.
- param [Hash] form A customizable set of form.
- option form [String] :name The name of a user. Defaults to email.
- option form [String] :skype The skype of a user.
- option form [String] :linkedin The linkedin of a user.
- option form [String] :twitter The twitter of a user.
- option form [Int32] :projects_limit The limit of projects for a user.
- return [JSON::Any] Information about created user.
Gitlab.create_user("icy.leaf@kaifeng.cn", "secret", "icyleaf", {"name" => "三火"})
Gitlab.create_user("icy.leaf@kaifeng.cn", "secret", "icyleaf")
Delete email for current user
- params [Int32] user_id The ID of a user.
- params [Int32] email_id Email address ID
- return [JSON::Any]
client.delete_email(1, 2)
Delete email for current user
- params [Int32] email_id Email address ID
- return [JSON::Any]
client.delete_email(2)
Deletes an SSH key for a user.
- param [Int32] user_id The Id of user.
- param [Int32] ssh_key_id The ID of a user"s SSH key.
- return [JSON::Any] Information about deleted SSH key.
client.delete_ssh_key(1, 1)
Deletes an SSH key for current user.
- param [Int32] ssh_key_id The ID of a user"s SSH key.
- return [JSON::Any] Information about deleted SSH key.
client.delete_ssh_key(1)
Deletes a user.
- param [Int32] user_id The ID of a user.
- return [JSON::Any] Information about deleted user.
client.delete_user(1)
Updates a user.
- param [Int32] id The ID of a user.
- param [Hash] params A customizable set of params.
- option params [String] :email The email of a user.
- option params [String] :password The password of a user.
- option params [String] :name The name of a user. Defaults to email.
- option params [String] :skype The skype of a user.
- option params [String] :linkedin The linkedin of a user.
- option params [String] :twitter The twitter of a user.
- option params [String] :projects_limit The limit of projects for a user.
- return [JSON::Any] Information about edit user.
client.edit_user(4, {"email" => "icy.leaf@kaifeng.cn", "projects_limit" => "100"})
Get a single email.
- param [Int32] email_id The ID of a email.
- return [JSON::Any]
client.email(3)
Gets a user emails.
- param [Int32] user_id The ID of a user.
- return [JSON::Any]
client.emails(2)
Gets information about SSH key.
- param [Int32] ssh_key_id The ID of a user"s SSH key.
- return [JSON::Any]
client.ssh_key(1)
Gets a list of a user"s SSH keys.
- param [Int32] user_id The Id of user.
- return [JSON::Any]
client.ssh_keys(4)
Unblocks the specified user.
Available only for admin.
- param [Int32] user_id The Id of user
- return [JSON::Any] success or not
client.unblock_user(4)
Gets information about a user.
- param [Int32] user_id The ID of a user.
- return [JSON::Any]
client.user(2)
Add's a user custom attribute
Available only for admin.
- param [Int32] user_id The Id of user
- param [String] the key of the custom attribute
- param [Hash] params A single param with the value of the custom attribute
- params [String] :value The value of the custom attribute.
- return [JSON::Any] information about the custom_attribute
client.user_add_custom_attribute(4, custom_key, {"value" => "custom_value"})
Gets a single user custom attribute
Available only for admin.
- param [Int32] user_id The Id of user
- param [String] the key of the custom attribute
- return [JSON::Any] information about the custom_attribute
client.user_custom_attribute(4, "custom_key")
List user custom attributes
Available only for admin.
- param [Int32] user_id The Id of user
- return [JSON::Any] information about the custom_attribute
client.user_custom_attributes(4)
Deletes a user custom attribute
Available only for admin.
- param [Int32] user_id The Id of user
- param [String] the key of the custom attribute
- return [JSON::Any] information about the custom_attribute
client.user_delete_custom_attribute(4, custom_key)
Search for user by name
- param [String] query A string to search for in group names and paths.
- param [Hash] params A customizable set of params.
- option params [String] :per_page Number of projects to return per page
- option params [String] :page The page to retrieve
- return [JSON::Any] List of projects under search qyery
client.group_search("icyleaf")
client.group_search("icyleaf", {"per_page" => 50})
Gets a list of users.
- param [Hash] params A customizable set of params.
- option params [String] :page The page number.
- option params [String] :per_page The number of results per page.
- return [JSON::Any]
client.users
client.users({"per_page" => "10", "page" => "2"})