| 1 | package Pithub::Repos::Statuses; | ||||||||||
| 2 | 16 | our $AUTHORITY = 'cpan:PLU'; | |||||||||
| 3 | 16 | our $VERSION = '0.01041'; | |||||||||
| 4 | |||||||||||
| 5 | # ABSTRACT: Github v3 repos / statuses 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 | |||||||||||
| 10 | 16 | extends 'Pithub::Base'; | |||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | sub list { | ||||||||||
| 14 | 2 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
list: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 15 | |||||||||||
| 16 | 2 | $self->_validate_user_repo_args( \%args ); | |||||||||
| 17 | my $req = { | ||||||||||
| 18 | method => 'GET', | ||||||||||
| 19 | path => sprintf( | ||||||||||
| 20 | '/repos/%s/%s/statuses/%s', | ||||||||||
| 21 | delete $args{user}, delete $args{repo}, delete $args{ref} | ||||||||||
| 22 | 2 | ), | |||||||||
| 23 | %args | ||||||||||
| 24 | }; | ||||||||||
| 25 | 2 | return $self->request(%$req); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | sub create { | ||||||||||
| 30 | 2 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
create: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||
| 31 | 2 | $self->_validate_user_repo_args( \%args ); | |||||||||
| 32 | croak | ||||||||||
| 33 | 'Missing state paramenter. Must be one of pending, success, error or failure' | ||||||||||
| 34 | 2 | ▶ | unless $args{data}->{state}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | 2 | ▶ | unless ( $args{data}->{state} =~ m/^(?:pending|success|error|failure)$/ ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | { | ||||||||||
| 38 | croak | ||||||||||
| 39 | 'state param must be one of pending, success, error, failure. Was ' | ||||||||||
| 40 | 0 | . $args{data}->{state}; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | my $req = { | ||||||||||
| 44 | method => 'POST', | ||||||||||
| 45 | path => sprintf( | ||||||||||
| 46 | '/repos/%s/%s/statuses/%s', | ||||||||||
| 47 | delete $args{user}, delete $args{repo}, delete $args{sha}, | ||||||||||
| 48 | 2 | ), | |||||||||
| 49 | %args | ||||||||||
| 50 | }; | ||||||||||
| 51 | |||||||||||
| 52 | 2 | return $self->request(%$req); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 16 | 1; | |||||||||
| 56 | |||||||||||
| 57 | __END__ | ||||||||||