forked from kriskbx/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.js
More file actions
47 lines (36 loc) · 725 Bytes
/
Copy pathuser.js
File metadata and controls
47 lines (36 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const _ = require('underscore');
/**
* user model
*/
class user {
constructor(data = {}) {
this.data = data;
}
make(username) {
let promise;
promise = this.get(`users?username=${username}`);
promise.then(user => {
this.data = user.body;
return promise;
});
return promise;
}
/*
* properties
*/
get id() {
return this.data.id;
}
get name() {
return this.data.name;
}
get state() {
return this.data.state === "active" ? true : false;
}
get avatar_url() {
return this.data.avatar_url;
}
get web_url() {
return this.data.web_url;
}
}