| 1 | 17 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 17 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package MetaCPAN::API::Rating; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 17 | our $VERSION = '0.52'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 17 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 17 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 17 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # /rating/{id} | ||||||||||||||||||||||||||||
| 12 | # /rating/_search | ||||||||||||||||||||||||||||
| 13 | 2 | ▶ | sub rating { | ||||||||||||||||||||||||||
|
Subroutine
rating: called CC=7 SCAR=26.2
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 15 | 2 | my $url = ''; | |||||||||||||||||||||||||||
| 16 | 2 | my $error = "Either provide 'id' or 'search'"; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | my %extra_opts = (); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 21 | 0 | $url = 'rating/' . shift; | |||||||||||||||||||||||||||
| 22 | } elsif ( @_ ) { | ||||||||||||||||||||||||||||
| 23 | 1 | my %opts = @_; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | if ( defined ( my $id = $opts{'id'} ) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 26 | 0 | $url = "rating/$id"; | |||||||||||||||||||||||||||
| 27 | } elsif ( defined ( my $search_opts = $opts{'search'} ) ) { | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | croak $error | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $search_opts and ref $search_opts eq "HASH"
MC/DC0%0/2
ref $search_opts and ref $search_opts eq "HASH"
ref $search_opts
ref $search_opts eq "HASH"
Truth table0%0/3
A and B
A= ref $search_optsB= ref $search_opts eq "HASH"
| |||||||||||||||||||||||||||||
| 29 | unless ref $search_opts && ref $search_opts eq 'HASH'; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | %extra_opts = %{$search_opts}; | |||||||||||||||||||||||||||
| 32 | 0 | $url = 'rating/_search'; | |||||||||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||||||||||
| 34 | 1 | croak $error; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||||||||||
| 37 | 1 | croak $error; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | return $self->fetch( $url, %extra_opts ); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 17 | 1; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||