Commit a7345e368a92396c04e9cd8d1a9c1ed2ed50d15e
1 parent
ae564c97
Exists in
spb-stable
and in
2 other branches
Fix gravatar size and update docs for new users API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
54 additions
and
1 deletions
Show diff stats
app/models/user.rb
doc/api/users.md
| ... | ... | @@ -6,6 +6,34 @@ Get a list of users. |
| 6 | 6 | |
| 7 | 7 | This function takes pagination parameters `page` and `per_page` to restrict the list of users. |
| 8 | 8 | |
| 9 | +### For normal users: | |
| 10 | + | |
| 11 | +``` | |
| 12 | +GET /users | |
| 13 | +``` | |
| 14 | + | |
| 15 | +```json | |
| 16 | +[ | |
| 17 | + { | |
| 18 | + "id": 1, | |
| 19 | + "username": "john_smith", | |
| 20 | + "name": "John Smith", | |
| 21 | + "state": "active", | |
| 22 | + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", | |
| 23 | + }, | |
| 24 | + { | |
| 25 | + "id": 2, | |
| 26 | + "username": "jack_smith", | |
| 27 | + "name": "Jack Smith", | |
| 28 | + "state": "blocked", | |
| 29 | + "avatar_url": "http://gravatar.com/../e32131cd8.jpeg", | |
| 30 | + } | |
| 31 | +] | |
| 32 | +``` | |
| 33 | + | |
| 34 | + | |
| 35 | +### For admins: | |
| 36 | + | |
| 9 | 37 | ``` |
| 10 | 38 | GET /users |
| 11 | 39 | ``` |
| ... | ... | @@ -29,6 +57,7 @@ GET /users |
| 29 | 57 | "theme_id": 1, |
| 30 | 58 | "color_scheme_id": 2, |
| 31 | 59 | "is_admin": false, |
| 60 | + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", | |
| 32 | 61 | "can_create_group": true |
| 33 | 62 | }, |
| 34 | 63 | { |
| ... | ... | @@ -48,6 +77,7 @@ GET /users |
| 48 | 77 | "theme_id": 1, |
| 49 | 78 | "color_scheme_id": 3, |
| 50 | 79 | "is_admin": false, |
| 80 | + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", | |
| 51 | 81 | "can_create_group": true, |
| 52 | 82 | "can_create_project": true |
| 53 | 83 | } |
| ... | ... | @@ -62,6 +92,29 @@ Also see `def search query` in `app/models/user.rb`. |
| 62 | 92 | |
| 63 | 93 | Get a single user. |
| 64 | 94 | |
| 95 | +#### For user: | |
| 96 | + | |
| 97 | +``` | |
| 98 | +GET /users/:id | |
| 99 | +``` | |
| 100 | + | |
| 101 | +Parameters: | |
| 102 | + | |
| 103 | +- `id` (required) - The ID of a user | |
| 104 | + | |
| 105 | +```json | |
| 106 | +{ | |
| 107 | + "id": 1, | |
| 108 | + "username": "john_smith", | |
| 109 | + "name": "John Smith", | |
| 110 | + "state": "active", | |
| 111 | + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", | |
| 112 | +} | |
| 113 | +``` | |
| 114 | + | |
| 115 | + | |
| 116 | +#### For admin: | |
| 117 | + | |
| 65 | 118 | ``` |
| 66 | 119 | GET /users/:id |
| 67 | 120 | ``` | ... | ... |