| 1 | package Pithub; | ||||||||||
| 2 | 15 | our $AUTHORITY = 'cpan:PLU'; | |||||||||
| 3 | |||||||||||
| 4 | # ABSTRACT: Github v3 API | ||||||||||
| 5 | |||||||||||
| 6 | 15 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 15 | our $VERSION = '0.01041'; | |||||||||
| 9 | |||||||||||
| 10 | 15 | ▶ | use Carp qw( croak ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 15 | ▶ | use Pithub::Events (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 15 | ▶ | use Pithub::Gists (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 15 | ▶ | use Pithub::GitData (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 15 | ▶ | use Pithub::Issues (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 15 | ▶ | use Pithub::Orgs (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 15 | ▶ | use Pithub::PullRequests (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 15 | ▶ | use Pithub::Markdown (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 15 | ▶ | use Pithub::Repos (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 15 | ▶ | use Pithub::Search (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 15 | ▶ | use Pithub::SearchV3 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 15 | ▶ | use Pithub::Users (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 15 | extends 'Pithub::Base'; | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | sub _validate_search_api { | ||||||||||
| 27 | 86 | ▶ | my %search_apis = map { $_ => 1 } qw(legacy v3); | ||||||||
|
Subroutine
_validate_search_api: called CC=2 SCAR=7.1
| |||||||||||
| 28 | croak "unknown search api '$_[0]'" | ||||||||||
| 29 | 86 | ▶ | unless exists $search_apis{ $_[0] }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | 15 | has search_api => ( | |||||||||
| 34 | is => 'ro', | ||||||||||
| 35 | isa => \&_validate_search_api, | ||||||||||
| 36 | default => 'legacy', | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | sub _search_class { | ||||||||||
| 40 | 3 | ▶ | my ( $self, $search_api ) = @_; | ||||||||
|
Subroutine
_search_class: called CC=2 SCAR=6.9
| |||||||||||
| 41 | |||||||||||
| 42 | 3 | _validate_search_api($search_api); | |||||||||
| 43 | |||||||||||
| 44 | 3 | ▶ | return $search_api eq 'legacy' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | ? Pithub::Search:: | ||||||||||
| 46 | : Pithub::SearchV3::; | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | sub events { | ||||||||||
| 51 | 3 | ▶ | return shift->_create_instance( Pithub::Events::, @_ ); | ||||||||
|
Subroutine
events: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | sub gists { | ||||||||||
| 56 | 3 | ▶ | return shift->_create_instance( Pithub::Gists::, @_ ); | ||||||||
|
Subroutine
gists: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | sub git_data { | ||||||||||
| 61 | 3 | ▶ | return shift->_create_instance( Pithub::GitData::, @_ ); | ||||||||
|
Subroutine
git_data: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | sub issues { | ||||||||||
| 66 | 4 | ▶ | return shift->_create_instance( Pithub::Issues::, @_ ); | ||||||||
|
Subroutine
issues: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | sub markdown { | ||||||||||
| 71 | 1 | ▶ | return shift->_create_instance( Pithub::Markdown::, @_ ); | ||||||||
|
Subroutine
markdown: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | |||||||||||
| 75 | sub orgs { | ||||||||||
| 76 | 3 | ▶ | return shift->_create_instance( Pithub::Orgs::, @_ ); | ||||||||
|
Subroutine
orgs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | sub pull_requests { | ||||||||||
| 81 | 9 | ▶ | return shift->_create_instance( Pithub::PullRequests::, @_ ); | ||||||||
|
Subroutine
pull_requests: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | |||||||||||
| 85 | sub repos { | ||||||||||
| 86 | 62 | ▶ | return shift->_create_instance( Pithub::Repos::, @_ ); | ||||||||
|
Subroutine
repos: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | |||||||||||
| 90 | sub search { | ||||||||||
| 91 | 3 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
search: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 92 | my $class = $self->_search_class( | ||||||||||
| 93 | exists $args{search_api} | ||||||||||
| 94 | ? delete $args{search_api} | ||||||||||
| 95 | 3 | ▶ | : $self->search_api, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | ); | ||||||||||
| 97 | 3 | return shift->_create_instance( $class, @_ ); | |||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | |||||||||||
| 101 | sub users { | ||||||||||
| 102 | 14 | ▶ | return shift->_create_instance( Pithub::Users::, @_ ); | ||||||||
|
Subroutine
users: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | |||||||||||
| 106 | 15 | 1; | |||||||||
| 107 | |||||||||||
| 108 | __END__ | ||||||||||