NARKOZ/gitlab — pull request #62 by tbpgr (2014-07-08 15:24:58+00:00)
Title: Fix users.rb. Add username argument to create_user method. Because, GitL...

Fix users.rb. Add username argument to create_user method. Because, GitLab API's create_user IF require username.

When I try to execute this code...

~~~ruby
# config code...
# :
# :
Gitlab.create_user('someone@hogehoge_higehige.com', 'some_passward')
~~~

Raise following error（I confirmed GitLab6.3 and GitLab7.0. same result.）

~~~bash
request.rb:60:in `validate': Server responded with code 400, message: 400 (Bad request) "username" not given.
Request URI: http://some_address/api/v3/users (Gitlab::Error::BadRequest)
~~~

So, I checked GitLab API code

https://github.com/gitlabhq/gitlabhq/blob/master/lib/api/users.rb

line 60

~~~ruby
required_attributes! [:email, :password, :name, :username]
~~~

'username' is required.

At least, following code is success.

~~~ruby
# config code...
# :
# :
Gitlab.create_user('someone@hogehoge_higehige.com', 'some_pass', username: 'some_user_name')
~~~

But, In GitLab API, username is requred attribute. Not optional...