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