| 1 | package Pithub::Events; | ||||||||||
| 2 | 16 | our $AUTHORITY = 'cpan:PLU'; | |||||||||
| 3 | 16 | our $VERSION = '0.01041'; | |||||||||
| 4 | |||||||||||
| 5 | # ABSTRACT: Github v3 Events API | ||||||||||
| 6 | |||||||||||
| 7 | 16 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 16 | ▶ | use Carp qw( croak ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 16 | extends 'Pithub::Base'; | |||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | sub issue { | ||||||||||
| 13 | 2 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
issue: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 14 | 2 | $self->_validate_user_repo_args( \%args ); | |||||||||
| 15 | return $self->request( | ||||||||||
| 16 | method => 'GET', | ||||||||||
| 17 | path => sprintf( | ||||||||||
| 18 | '/repos/%s/%s/issues/events', delete $args{user}, | ||||||||||
| 19 | delete $args{repo} | ||||||||||
| 20 | 2 | ), | |||||||||
| 21 | %args, | ||||||||||
| 22 | ); | ||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | sub network { | ||||||||||
| 27 | 2 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
network: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 2 | $self->_validate_user_repo_args( \%args ); | |||||||||
| 29 | return $self->request( | ||||||||||
| 30 | method => 'GET', | ||||||||||
| 31 | path => sprintf( | ||||||||||
| 32 | '/networks/%s/%s/events', delete $args{user}, delete $args{repo} | ||||||||||
| 33 | 2 | ), | |||||||||
| 34 | %args, | ||||||||||
| 35 | ); | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | sub org { | ||||||||||
| 40 | 3 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
org: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | 3 | ▶ | croak 'Missing key in parameters: org' unless $args{org}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | return $self->request( | ||||||||||
| 43 | method => 'GET', | ||||||||||
| 44 | 2 | path => sprintf( '/orgs/%s/events', delete $args{org} ), | |||||||||
| 45 | %args, | ||||||||||
| 46 | ); | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | sub org_for_user { | ||||||||||
| 51 | 5 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
org_for_user: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 52 | 5 | ▶ | croak 'Missing key in parameters: org' unless $args{org}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 4 | ▶ | croak 'Missing key in parameters: user' unless $args{user}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | return $self->request( | ||||||||||
| 55 | method => 'GET', | ||||||||||
| 56 | path => sprintf( | ||||||||||
| 57 | '/users/%s/events/orgs/%s', delete $args{user}, delete $args{org} | ||||||||||
| 58 | 3 | ), | |||||||||
| 59 | %args, | ||||||||||
| 60 | ); | ||||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | sub public { | ||||||||||
| 65 | 2 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
public: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 66 | 2 | return $self->request( | |||||||||
| 67 | method => 'GET', | ||||||||||
| 68 | path => '/events', | ||||||||||
| 69 | %args, | ||||||||||
| 70 | ); | ||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | sub repos { | ||||||||||
| 75 | 2 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
repos: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 76 | 2 | $self->_validate_user_repo_args( \%args ); | |||||||||
| 77 | return $self->request( | ||||||||||
| 78 | method => 'GET', | ||||||||||
| 79 | path => sprintf( | ||||||||||
| 80 | '/repos/%s/%s/events', delete $args{user}, delete $args{repo} | ||||||||||
| 81 | 2 | ), | |||||||||
| 82 | %args, | ||||||||||
| 83 | ); | ||||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | |||||||||||
| 87 | sub user_performed { | ||||||||||
| 88 | 4 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
user_performed: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 89 | 4 | ▶ | croak 'Missing key in parameters: user' unless $args{user}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 90 | 3 | my $path = sprintf( '/users/%s/events', delete $args{user} ); | |||||||||
| 91 | 3 | ▶ | if ( $args{public} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | 1 | $path .= '/public'; | |||||||||
| 93 | } | ||||||||||
| 94 | 3 | return $self->request( | |||||||||
| 95 | method => 'GET', | ||||||||||
| 96 | path => $path, | ||||||||||
| 97 | %args, | ||||||||||
| 98 | ); | ||||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | sub user_received { | ||||||||||
| 103 | 4 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
user_received: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 104 | 4 | ▶ | croak 'Missing key in parameters: user' unless $args{user}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 105 | 3 | my $path = sprintf( '/users/%s/received_events', delete $args{user} ); | |||||||||
| 106 | 3 | ▶ | if ( $args{public} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 107 | 1 | $path .= '/public'; | |||||||||
| 108 | } | ||||||||||
| 109 | 3 | return $self->request( | |||||||||
| 110 | method => 'GET', | ||||||||||
| 111 | path => $path, | ||||||||||
| 112 | %args, | ||||||||||
| 113 | ); | ||||||||||
| 114 | } | ||||||||||
| 115 | |||||||||||
| 116 | 16 | 1; | |||||||||
| 117 | |||||||||||
| 118 | __END__ | ||||||||||