| 1 | package WWW::Gitea::PullRequest; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Gitea pull request entity | ||||||||||
| 4 | |||||||||||
| 5 | 5 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 5 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | |||||||||||
| 9 | 5 | has _client => ( | |||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | required => 1, | ||||||||||
| 12 | weak_ref => 1, | ||||||||||
| 13 | init_arg => 'client', | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | 5 | has data => ( | |||||||||
| 17 | is => 'rw', | ||||||||||
| 18 | required => 1, | ||||||||||
| 19 | ); | ||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | 5 | has owner => ( is => 'ro' ); | |||||||||
| 23 | 5 | has repo => ( is => 'ro' ); | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 2 | ▶ | sub _base_repo { $_[0]->data->{base} ? $_[0]->data->{base}{repo} : undef } | ||||||||
|
Subroutine
_base_repo: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 1 | ▶ | sub _owner { | ||||||||
|
Subroutine
_owner: called CC=4 SCAR=14.9
| |||||||||||
| 29 | 1 | my ($self) = @_; | |||||||||
| 30 | 1 | ▶ | return $self->owner if defined $self->owner; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 1 | ▶ | my $r = $self->_base_repo or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 1 | ▶ | return $r->{owner} ? $r->{owner}{login} : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | sub _repo { | ||||||||
|
Subroutine
_repo: called CC=3 SCAR=11.4
| |||||||||||
| 36 | 1 | my ($self) = @_; | |||||||||
| 37 | 1 | ▶ | return $self->repo if defined $self->repo; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 1 | ▶ | my $r = $self->_base_repo or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 1 | return $r->{name}; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub id { $_[0]->data->{id} } | ||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | 1 | ▶ | sub number { $_[0]->data->{number} } | ||||||||
|
Subroutine
number: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 44 | 0 | ▶ | sub title { $_[0]->data->{title} } | ||||||||
|
Subroutine
title: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 45 | 0 | ▶ | sub body { $_[0]->data->{body} } | ||||||||
|
Subroutine
body: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 46 | 0 | ▶ | sub state { $_[0]->data->{state} } | ||||||||
|
Subroutine
state: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 47 | 0 | ▶ | sub merged { $_[0]->data->{merged} } | ||||||||
|
Subroutine
merged: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | 0 | ▶ | sub mergeable { $_[0]->data->{mergeable} } | ||||||||
|
Subroutine
mergeable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 49 | 0 | ▶ | sub html_url { $_[0]->data->{html_url} } | ||||||||
|
Subroutine
html_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 50 | 0 | ▶ | sub created_at { $_[0]->data->{created_at} } | ||||||||
|
Subroutine
created_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | ▶ | sub updated_at { $_[0]->data->{updated_at} } | ||||||||
|
Subroutine
updated_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | ▶ | sub user_login { my $u = $_[0]->data->{user}; $u ? $u->{login} : undef } | ||||||||
|
Subroutine
user_login: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 53 | 1 | ▶ | sub head_branch { my $h = $_[0]->data->{head}; $h ? $h->{ref} : undef } | ||||||||
|
Subroutine
head_branch: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||
| 54 | 1 | ▶ | sub base_branch { my $b = $_[0]->data->{base}; $b ? $b->{ref} : undef } | ||||||||
|
Subroutine
base_branch: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||
| 55 | |||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub refresh { | ||||||||
|
Subroutine
refresh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 58 | 0 | my ($self) = @_; | |||||||||
| 59 | 0 | my $fresh = $self->_client->pulls->get($self->_owner, $self->_repo, $self->number); | |||||||||
| 60 | 0 | $self->data($fresh->data); | |||||||||
| 61 | 0 | return $self; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | sub edit { | ||||||||
|
Subroutine
edit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 66 | 0 | my ($self, %args) = @_; | |||||||||
| 67 | 0 | my $fresh = $self->_client->pulls->edit( | |||||||||
| 68 | $self->_owner, $self->_repo, $self->number, %args); | ||||||||||
| 69 | 0 | $self->data($fresh->data); | |||||||||
| 70 | 0 | return $self; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | sub merge { | ||||||||
|
Subroutine
merge: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 75 | 0 | my ($self, %args) = @_; | |||||||||
| 76 | 0 | return $self->_client->pulls->merge( | |||||||||
| 77 | $self->_owner, $self->_repo, $self->number, %args); | ||||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | |||||||||||
| 81 | 0 | ▶ | sub is_merged { | ||||||||
|
Subroutine
is_merged: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 82 | 0 | my ($self) = @_; | |||||||||
| 83 | 0 | return $self->_client->pulls->is_merged( | |||||||||
| 84 | $self->_owner, $self->_repo, $self->number); | ||||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | sub close { | ||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 89 | 0 | my ($self) = @_; | |||||||||
| 90 | 0 | return $self->edit(state => 'closed'); | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | 5 | 1; | |||||||||
| 96 | |||||||||||
| 97 | __END__ | ||||||||||