summaryrefslogtreecommitdiff
path: root/lib/github/representation/user.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-11 22:34:59 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-24 16:17:52 -0300
commitb43ecca9060b3d7ffd84d700caecf5f35fd403a9 (patch)
tree8b23af77d44d2dc854aff7d68179b63867bf5436 /lib/github/representation/user.rb
parentfc42f3dffa364a360c76ff2785813d74f42016c7 (diff)
downloadgitlab-ce-b43ecca9060b3d7ffd84d700caecf5f35fd403a9.tar.gz
Add basic representations for the Github API results
Diffstat (limited to 'lib/github/representation/user.rb')
-rw-r--r--lib/github/representation/user.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/github/representation/user.rb b/lib/github/representation/user.rb
new file mode 100644
index 00000000000..70a0ce000ae
--- /dev/null
+++ b/lib/github/representation/user.rb
@@ -0,0 +1,19 @@
+module Github
+ module Representation
+ class User < Representation::Base
+ def id
+ raw['id']
+ end
+
+ def email
+ return @email if defined?(@email)
+
+ @email = Github::User.new(username).get.fetch('email', nil)
+ end
+
+ def username
+ raw['login']
+ end
+ end
+ end
+end