diff --git a/.gitignore b/.gitignore index 2de390492..653ec681c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ test/tmp test/version_tmp tmp .idea +.ruby-version +.ruby-gemset diff --git a/lib/gitlab/client/users.rb b/lib/gitlab/client/users.rb index c1df8a06d..2231ec195 100644 --- a/lib/gitlab/client/users.rb +++ b/lib/gitlab/client/users.rb @@ -44,6 +44,23 @@ def create_user(email, password, options={}) post("/users", :body => body) end + # Update a user. + # Requires authentication from an admin account. + # + # @param [String] The user's id + # @param [Hash] options A customizable set of options. + # @option options [String] email The email of a user. + # @option options [String] password The password of a user. + # @option options [String] :name The name of a user. Defaults to email. + # @option options [String] :skype The skype of a user. + # @option options [String] :linkedin The linkedin of a user. + # @option options [String] :twitter The twitter of a user. + # @option options [Integer] :projects_limit The limit of projects for a user. + # @return [Gitlab::ObjectifiedHash] Information about created user. + def edit_user(user_id, options={}) + put("/users/#{user_id}", :body => options) + end + # Creates a new user session. # # @example diff --git a/spec/gitlab/client/users_spec.rb b/spec/gitlab/client/users_spec.rb index 7dbf87bad..a20ff7e71 100644 --- a/spec/gitlab/client/users_spec.rb +++ b/spec/gitlab/client/users_spec.rb @@ -76,6 +76,18 @@ end end + describe ".edit_user" do + before do + @options = { :name => "Roberto" } + stub_put("/users/1", "user").with(:body => @options) + @user = Gitlab.edit_user(1, @options) + end + + it "should get the correct resource" do + a_put("/users/1").with(:body => @options).should have_been_made + end + end + describe ".session" do before do stub_post("/session", "session")