Skip to content

Commit

Permalink
Use coderwall username from metacpan api.
Browse files Browse the repository at this point in the history
  • Loading branch information
plu committed Sep 29, 2013
1 parent d48307e commit ed16f4f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/lib/GMC/Cron/Update.pm
Expand Up @@ -181,7 +181,7 @@ sub fetch_github_repos {
sub fetch_coderwall_user {
my ( $self, $user ) = @_;

my $url = sprintf 'http://coderwall.com/%s.json', $user->{github_user};
my $url = sprintf 'http://coderwall.com/%s.json', $user->{coderwall_user};
my $response = $self->lwp->get($url);

unless ( $response->is_success ) {
Expand Down Expand Up @@ -214,21 +214,21 @@ sub fetch_metacpan_users {
foreach my $row ( @{ $data->{hits}{hits} } ) {
$row = $row->{_source};

my $coderwall_user;
my $github_user;
foreach my $profile ( @{ $row->{profile} || [] } ) {
if ( $profile->{name} eq 'github' ) {
$github_user = $profile->{id};
last;
}
$github_user = $profile->{id} if $profile->{name} eq 'github';
$coderwall_user = $profile->{id} if $profile->{name} eq 'coderwall';
}

push @result,
{
github_user => $github_user,
gravatar_url => $row->{gravatar_url},
name => $row->{name},
pauseid => $row->{pauseid},
metacpan_url => 'https://metacpan.org/author/' . $row->{pauseid},
github_user => $github_user,
coderwall_user => $coderwall_user || $github_user,
gravatar_url => $row->{gravatar_url},
name => $row->{name},
pauseid => $row->{pauseid},
metacpan_url => 'https://metacpan.org/author/' . $row->{pauseid},
};
}

Expand Down

0 comments on commit ed16f4f

Please sign in to comment.