Module: Gitlab::Client::Users
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/users.rb
Overview
Defines methods related to users.
Instance Method Summary collapse
-
#create_ssh_key(title, key) ⇒ Gitlab::ObjectifiedHash
Creates a new SSH key.
-
#create_user(email, password, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new user.
-
#delete_ssh_key(id) ⇒ Gitlab::ObjectifiedHash
Deletes an SSH key.
-
#edit_user(user_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a user.
-
#session(email, password) ⇒ Gitlab::ObjectifiedHash
Creates a new user session.
-
#ssh_key(id) ⇒ Gitlab::ObjectifiedHash
Gets information about SSH key.
-
#ssh_keys(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of user’s SSH keys.
-
#user(id = nil) ⇒ Gitlab::ObjectifiedHash
Gets information about a user.
-
#users(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of users.
Instance Method Details
#create_ssh_key(title, key) ⇒ Gitlab::ObjectifiedHash
Creates a new SSH key.
108 109 110 |
# File 'lib/gitlab/client/users.rb', line 108 def create_ssh_key(title, key) post("/user/keys", :body => {:title => title, :key => key}) end |
#create_user(email, password, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new user. Requires authentication from an admin account.
42 43 44 45 |
# File 'lib/gitlab/client/users.rb', line 42 def create_user(email, password, ={}) body = {:email => email, :password => password, :name => email}.merge() post("/users", :body => body) end |
#delete_ssh_key(id) ⇒ Gitlab::ObjectifiedHash
Deletes an SSH key.
119 120 121 |
# File 'lib/gitlab/client/users.rb', line 119 def delete_ssh_key(id) delete("/user/keys/#{id}") end |
#edit_user(user_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a user.
59 60 61 |
# File 'lib/gitlab/client/users.rb', line 59 def edit_user(user_id, ={}) put("/users/#{user_id}", :body => ) end |
#session(email, password) ⇒ Gitlab::ObjectifiedHash
Note:
This method doesn’t require private_token to be set.
Creates a new user session.
72 73 74 |
# File 'lib/gitlab/client/users.rb', line 72 def session(email, password) post("/session", :body => {:email => email, :password => password}) end |
#ssh_key(id) ⇒ Gitlab::ObjectifiedHash
Gets information about SSH key.
96 97 98 |
# File 'lib/gitlab/client/users.rb', line 96 def ssh_key(id) get("/user/keys/#{id}") end |
#ssh_keys(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of user’s SSH keys.
85 86 87 |
# File 'lib/gitlab/client/users.rb', line 85 def ssh_keys(={}) get("/user/keys", :query => ) end |
#user(id = nil) ⇒ Gitlab::ObjectifiedHash
Gets information about a user. Will return information about an authorized user if no ID passed.
26 27 28 |
# File 'lib/gitlab/client/users.rb', line 26 def user(id=nil) id.to_i.zero? ? get("/user") : get("/users/#{id}") end |
#users(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of users.
13 14 15 |
# File 'lib/gitlab/client/users.rb', line 13 def users(={}) get("/users", :query => ) end |