Measurement/Geo/Foursquare.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 30 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Exobrain::Measurement::Geo::Foursquare;
2 use Moose;
3 use Method::Signatures;
4  
5 with 'Exobrain::Measurement::Geo';
6  
7 # ABSTRACT: Foursquare location measurement class
8 our $VERSION = '0.01'; # VERSION
9  
10  
11 around BUILDARGS => func ($orig!, $class!, :$checkin?, ...) {
12  
13 if ($checkin) {
14  
15 # We have a checkin parameter. Auto-inflate that into our
16 # pull packet. Note that we pass `@_` at the end, so any
17 # caller-supplied additional parameters will override what's
18 # in the packet.
19  
20 my $name = ( $checkin->{user}{firstName} // "" ) . " "
21 . ( $checkin->{user}{lastName } // "" );
22  
23 my $user = $checkin->{user}{id};
24  
25 return $class->$orig(
26 source => 'Foursquare',
27 timestamp => $checkin->{createdAt},
28 is_me => ($checkin->{user}{relationship} eq 'self'),
29 user => $user,
30 user_name => $name,
31 message => $checkin->{shout} // "",
32 poi => {
33 name => $checkin->{venue}{name},
34 id => $checkin->{venue}{id},
35 lat => $checkin->{venue}{location}{lat},
36 long => $checkin->{venue}{location}{lng},
37 },
38 raw => $checkin,
39 @_,
40 );
41 }
42  
43 # Not an auto-inflating check-in, then...
44 return $class->$orig(@_);
45 };
46  
47 1;
48  
49 __END__