summaryrefslogtreecommitdiff
path: root/lib/StarGit/Info.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-06-16 15:09:52 +0200
committerfranck cuny <franck@lumberjaph.net>2011-06-16 15:38:42 +0200
commitce141c9536987034d76276a14dfcae3b53a77f60 (patch)
tree6d125469f46a4fddc07c95a955c7b86f9ef160b8 /lib/StarGit/Info.pm
parentInterface update (WARNING: Flash to JS communication is currently broken, and... (diff)
downloadstargit-ce141c9536987034d76276a14dfcae3b53a77f60.tar.gz
add new webservice to return informations about a profile
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to 'lib/StarGit/Info.pm')
-rw-r--r--lib/StarGit/Info.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/StarGit/Info.pm b/lib/StarGit/Info.pm
new file mode 100644
index 0000000..589ef01
--- /dev/null
+++ b/lib/StarGit/Info.pm
@@ -0,0 +1,30 @@
+package StarGit::Info;
+
+use Moose;
+
+has login => (
+ isa => 'Str',
+ required => 1,
+ is => 'ro',
+);
+
+with qw(
+ GitHub::Collector::Role::MongoDB
+);
+
+sub get {
+ my $self = shift;
+
+ my $profile = $self->db_profiles->findOne( { login => $self->login } );
+ return undef unless defined $profile;
+
+ return {
+ login => $self->login,
+ name => $profile->{name},
+ email => $profile->{email},
+ website => $profile->{website},
+ gravatar => $profile->{gravatar},
+ };
+}
+
+1;