File Coverage

blib/lib/Pithub/Search.pm
Criterion Covered Total %
statement 20 20 100.0
branch 10 10 100.0
condition n/a
subroutine 6 6 100.0
pod 4 4 100.0
total 40 40 100.0


line stmt bran cond sub pod time code
1             package Pithub::Search;
2             our $AUTHORITY = 'cpan:PLU';
3             our $VERSION = '0.01039';
4             # ABSTRACT: Github legacy Search API
5              
6 15     15   88199 use Moo;
  15         10800  
  15         79  
7 15     15   5459 use Carp qw( croak );
  15         33  
  15         4707  
8             extends 'Pithub::Base';
9              
10              
11             sub email {
12 4     4 1 13600 my ( $self, %args ) = @_;
13 4 100       45 croak 'Missing key in parameters: email' unless $args{email};
14             return $self->request(
15             method => 'GET',
16 3         60 path => sprintf( '/legacy/user/email/%s', delete $args{email} ),
17             %args,
18             );
19             }
20              
21              
22             sub issues {
23 5     5 1 4890 my ( $self, %args ) = @_;
24 5         39 $self->_validate_user_repo_args( \%args );
25 5 100       37 croak 'Missing key in parameters: state' unless $args{state};
26 4 100       20 croak 'Missing key in parameters: keyword' unless $args{keyword};
27             return $self->request(
28             method => 'GET',
29 3         41 path => sprintf( '/legacy/issues/search/%s/%s/%s/%s', delete $args{user}, delete $args{repo}, delete $args{state}, delete $args{keyword} ),
30             %args,
31             );
32             }
33              
34              
35             sub repos {
36 4     4 1 4324 my ( $self, %args ) = @_;
37 4 100       38 croak 'Missing key in parameters: keyword' unless $args{keyword};
38             return $self->request(
39             method => 'GET',
40 3         39 path => sprintf( '/legacy/repos/search/%s', delete $args{keyword} ),
41             %args,
42             );
43             }
44              
45              
46             sub users {
47 4     4 1 3839 my ( $self, %args ) = @_;
48 4 100       38 croak 'Missing key in parameters: keyword' unless $args{keyword};
49             return $self->request(
50             method => 'GET',
51 3         40 path => sprintf( '/legacy/user/search/%s', delete $args{keyword} ),
52             %args,
53             );
54             }
55              
56             1;
57              
58             __END__