blib/lib/WebService/Pixabay.pm

filter: Statementstmt 30.1% 19 / 63 Branchbran 0.0% 0 / 72 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 16.3% 25 / 153 CC 39 SCAR 59.5
CC
39
Cov
13%
image_search
462.0
video_search
380.0
BEGIN
1.0
CRAP 384.7
↑ Summary
1 #This software is Copyright (c) 2017-2018 by faraco.
2 #
3 #This is free software, licensed under:
4 #
5 # The MIT (X11) License
6  
7 package WebService::Pixabay;
8 1 $WebService::Pixabay::VERSION = '2.2.3';
9 # ABSTRACT: Perl 5 interface to Pixabay API.
10  
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Function::Parameters;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 with 'WebService::Client';
18  
19 # api_key
20 1 has api_key => (
21 is => 'ro',
22 required => 1
23 );
24  
25 1 has '+base_url' => ( default => 'https://pixabay.com/api/' );
26  
27 0 ▶method image_search(
Subroutine image_search: not called CC=21 SCAR=61.4
Pod documented
28 : $q = "yellow flower",
29 : $lang = "en",
30 : $id = "",
31 : $response_group = "image_details",
32 : $image_type = "all",
33 : $orientation = "all",
34 : $category = "",
35 : $min_width = 0,
36 : $min_height = 0,
37 : $editors_choice = "false",
38 : $safesearch = "false",
39 : $order = "popular",
40 : $page = 1,
41 : $per_page = 20,
42 : $callback = "",
43 : $pretty = "false"
44 )
45 0 ▶{
Branch: 19 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method image_search (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and (@_ - 1) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method image_search") 0 0 0
exists ${__rest}{'q'} ? : 0 0 0
exists ${__rest}{'lang'} ? : 0 0 0
exists ${__rest}{'id'} ? : 0 0 0
exists ${__rest}{'response_group'} ? : 0 0 0
exists ${__rest}{'image_type'} ? : 0 0 0
exists ${__rest}{'orientation'} ? : 0 0 0
exists ${__rest}{'category'} ? : 0 0 0
exists ${__rest}{'min_width'} ? : 0 0 0
exists ${__rest}{'min_height'} ? : 0 0 0
exists ${__rest}{'editors_choice'} ? : 0 0 0
exists ${__rest}{'safesearch'} ? : 0 0 0
exists ${__rest}{'order'} ? : 0 0 0
exists ${__rest}{'page'} ? : 0 0 0
exists ${__rest}{'per_page'} ? : 0 0 0
exists ${__rest}{'callback'} ? : 0 0 0
exists ${__rest}{'pretty'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method image_search: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 1 and (@_ - 1) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 1 and (@_ - 1) % 2
@_ > 1 (@_ - 1) % 2
Truth table0%0/3
A and B
A= @_ > 1B= (@_ - 1) % 2
ABresult
0X0
100
111
46 0 return $self->get( "?key="
47 . $self->api_key
48 . "&q=$q&lang=$lang&id=$id&response_group=$response_group&image_type=$image_type"
49 . "&orientation=$orientation&category=$category&min_width=$min_width&mind_height=$min_height"
50 . "&editors_choice=$editors_choice&safesearch=$safesearch&order=$order&page=$page"
51 . "&per_page=$per_page&callback=$callback&pretty=$pretty" );
52 1 }
53  
54 0 ▶method video_search(
Subroutine video_search: not called CC=19 SCAR=59.4
Pod documented
55 : $q = "yellow flower",
56 : $lang = "en",
57 : $id = "",
58 : $video_type = "all",
59 : $category = "",
60 : $min_width = 0,
61 : $min_height = 0,
62 : $editors_choice = "false",
63 : $safesearch = "false",
64 : $order = "popular",
65 : $page = 1,
66 : $per_page = 20,
67 : $callback = "",
68 : $pretty = "false"
69 )
70 0 ▶{
Branch: 17 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method video_search (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and (@_ - 1) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method video_search") 0 0 0
exists ${__rest}{'q'} ? : 0 0 0
exists ${__rest}{'lang'} ? : 0 0 0
exists ${__rest}{'id'} ? : 0 0 0
exists ${__rest}{'video_type'} ? : 0 0 0
exists ${__rest}{'category'} ? : 0 0 0
exists ${__rest}{'min_width'} ? : 0 0 0
exists ${__rest}{'min_height'} ? : 0 0 0
exists ${__rest}{'editors_choice'} ? : 0 0 0
exists ${__rest}{'safesearch'} ? : 0 0 0
exists ${__rest}{'order'} ? : 0 0 0
exists ${__rest}{'page'} ? : 0 0 0
exists ${__rest}{'per_page'} ? : 0 0 0
exists ${__rest}{'callback'} ? : 0 0 0
exists ${__rest}{'pretty'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method video_search: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 1 and (@_ - 1) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 1 and (@_ - 1) % 2
@_ > 1 (@_ - 1) % 2
Truth table0%0/3
A and B
A= @_ > 1B= (@_ - 1) % 2
ABresult
0X0
100
111
71 0 return $self->get( "videos/?key="
72 . $self->api_key
73 . "&q=$q&lang=$lang&id=$id&video_type=$video_type"
74 . "&category=$category&min_width=$min_width&mind_height=$min_height"
75 . "&editors_choice=$editors_choice&safesearch=$safesearch&order=$order&page=$page"
76 . "&per_page=$per_page&callback=$callback&pretty=$pretty" );
77 1 }
78  
79 1 1;
80  
81 __END__
↑ Summary