| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Pithub::Repos::Statuses; | 
| 2 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:PLU'; | 
| 3 |  |  |  |  |  |  | our $VERSION = '0.01041'; | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | # ABSTRACT:  Github v3 repos / statuses API | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 16 |  |  | 16 |  | 140 | use Moo; | 
|  | 16 |  |  |  |  | 32 |  | 
|  | 16 |  |  |  |  | 92 |  | 
| 8 | 16 |  |  | 16 |  | 4854 | use Carp qw( croak ); | 
|  | 16 |  |  |  |  | 32 |  | 
|  | 16 |  |  |  |  | 5961 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | extends 'Pithub::Base'; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub list { | 
| 14 | 2 |  |  | 2 | 1 | 1568 | my ( $self, %args ) = @_; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 2 |  |  |  |  | 15 | $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 |  |  |  |  | 35 | ), | 
| 23 |  |  |  |  |  |  | %args | 
| 24 |  |  |  |  |  |  | }; | 
| 25 | 2 |  |  |  |  | 18 | return $self->request(%$req); | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub create { | 
| 30 | 2 |  |  | 2 | 1 | 8369 | my ( $self, %args ) = @_; | 
| 31 | 2 |  |  |  |  | 17 | $self->_validate_user_repo_args( \%args ); | 
| 32 |  |  |  |  |  |  | croak | 
| 33 |  |  |  |  |  |  | 'Missing state paramenter. Must be one of pending, success, error or failure' | 
| 34 | 2 | 50 |  |  |  | 17 | unless $args{data}->{state}; | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 2 | 50 |  |  |  | 23 | unless ( $args{data}->{state} =~ m/^(?:pending|success|error|failure)$/ ) | 
| 37 |  |  |  |  |  |  | { | 
| 38 |  |  |  |  |  |  | croak | 
| 39 |  |  |  |  |  |  | 'state param must be one of pending, success, error, failure. Was ' | 
| 40 | 0 |  |  |  |  | 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 |  |  |  |  | 35 | ), | 
| 49 |  |  |  |  |  |  | %args | 
| 50 |  |  |  |  |  |  | }; | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 2 |  |  |  |  | 17 | return $self->request(%$req); | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | 1; | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | __END__ |