| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::BitBucketCli::PullRequest; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # Created on: 2015-09-16 16:41:19 | 
| 4 |  |  |  |  |  |  | # Create by:  Ivan Wills | 
| 5 |  |  |  |  |  |  | # $Id$ | 
| 6 |  |  |  |  |  |  | # $Revision$, $HeadURL$, $Date$ | 
| 7 |  |  |  |  |  |  | # $Revision$, $Source$, $Date$ | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 1 |  |  | 1 |  | 6 | use Moo; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 10 | 1 |  |  | 1 |  | 260 | use warnings; | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 36 |  | 
| 11 | 1 |  |  | 1 |  | 6 | use Carp; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 47 |  | 
| 12 | 1 |  |  | 1 |  | 5 | use Data::Dumper qw/Dumper/; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 13 | 1 |  |  | 1 |  | 5 | use English qw/ -no_match_vars /; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our $VERSION = 0.008; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | extends qw/App::BitBucketCli::Base/; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | has [qw/ | 
| 20 |  |  |  |  |  |  | state | 
| 21 |  |  |  |  |  |  | toRef | 
| 22 |  |  |  |  |  |  | closed | 
| 23 |  |  |  |  |  |  | version | 
| 24 |  |  |  |  |  |  | attributes | 
| 25 |  |  |  |  |  |  | open | 
| 26 |  |  |  |  |  |  | fromRef | 
| 27 |  |  |  |  |  |  | updatedDate | 
| 28 |  |  |  |  |  |  | createdDate | 
| 29 |  |  |  |  |  |  | title | 
| 30 |  |  |  |  |  |  | reviewers | 
| 31 |  |  |  |  |  |  | participants | 
| 32 |  |  |  |  |  |  | author | 
| 33 |  |  |  |  |  |  | /] => ( | 
| 34 |  |  |  |  |  |  | is  => 'rw', | 
| 35 |  |  |  |  |  |  | ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | has emails => ( | 
| 38 |  |  |  |  |  |  | is      => 'rw', | 
| 39 |  |  |  |  |  |  | builder => '_emails', | 
| 40 |  |  |  |  |  |  | lazy    => 1, | 
| 41 |  |  |  |  |  |  | ); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub _emails { | 
| 44 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 45 | 0 |  |  |  |  |  | my %emails; | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | my %email; | 
| 48 | 0 |  |  |  |  |  | for my $users (qw/author participants reviewers/) { | 
| 49 | 0 | 0 |  |  |  |  | if ( !$self->$users ) { | 
| 50 | 0 |  |  |  |  |  | warn "No $users in " . $self->from_branch . "!\n"; | 
| 51 | 0 |  |  |  |  |  | next; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 | 0 |  |  |  |  | for my $user (@{ ref $self->$users eq 'ARRAY' ? $self->{$users} : [$self->{$users}] }) { | 
|  | 0 |  |  |  |  |  |  | 
| 55 | 0 |  |  |  |  |  | $emails{ $user->{user}{emailAddress} }++; | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 0 |  |  |  |  |  | return [ sort keys %emails ]; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 0 |  |  | 0 | 1 |  | sub from_branch     { $_[0]->fromRef->{displayId}; } | 
| 63 | 0 |  |  | 0 | 1 |  | sub to_branch       { $_[0]->toRef->{displayId}; } | 
| 64 | 0 |  |  | 0 | 1 |  | sub from_repository { $_[0]->fromRef->{repository}{name}; } | 
| 65 | 0 |  |  | 0 | 1 |  | sub to_repository   { $_[0]->toRef->{repository}{name}; } | 
| 66 | 0 |  |  | 0 | 1 |  | sub from_project    { $_[0]->fromRef->{repository}{project}{name}; } | 
| 67 | 0 |  |  | 0 | 1 |  | sub to_project      { $_[0]->toRef->{repository}{project}{name}; } | 
| 68 |  |  |  |  |  |  | sub from_name { | 
| 69 | 0 |  |  | 0 | 1 |  | $_[0]->from_project | 
| 70 |  |  |  |  |  |  | . '/' | 
| 71 |  |  |  |  |  |  | . $_[0]->from_repository | 
| 72 |  |  |  |  |  |  | . '/' | 
| 73 |  |  |  |  |  |  | . $_[0]->from_branch; | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  | sub to_name   { | 
| 76 | 0 |  |  | 0 | 1 |  | $_[0]->to_project | 
| 77 |  |  |  |  |  |  | . '/' | 
| 78 |  |  |  |  |  |  | . $_[0]->to_repository | 
| 79 |  |  |  |  |  |  | . '/' | 
| 80 |  |  |  |  |  |  | . $_[0]->to_branch; | 
| 81 |  |  |  |  |  |  | } | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | sub from_data { | 
| 84 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | return { | 
| 87 |  |  |  |  |  |  | branch      => $self->from_branch, | 
| 88 |  |  |  |  |  |  | project     => $self->from_project, | 
| 89 |  |  |  |  |  |  | project_key => $self->fromRef->{repository}{project}{key}, | 
| 90 | 0 |  |  |  |  |  | repository  => $self->from_repository, | 
| 91 |  |  |  |  |  |  | release_age => undef, | 
| 92 |  |  |  |  |  |  | }; | 
| 93 |  |  |  |  |  |  | } | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | sub to_data { | 
| 96 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | return { | 
| 99 |  |  |  |  |  |  | branch      => $self->to_branch, | 
| 100 |  |  |  |  |  |  | project     => $self->to_project, | 
| 101 |  |  |  |  |  |  | project_key => $self->toRef->{repository}{project}{key}, | 
| 102 | 0 |  |  |  |  |  | repository  => $self->to_repository, | 
| 103 |  |  |  |  |  |  | release_age => undef, | 
| 104 |  |  |  |  |  |  | }; | 
| 105 |  |  |  |  |  |  | } | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | 1; | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | __END__ | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =head1 NAME | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | App::BitBucketCli::PullRequest - Stores details about a pull request | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head1 VERSION | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | This documentation refers to App::BitBucketCli::PullRequest version 0.008 | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | use App::BitBucketCli::PullRequest; | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | # Brief but working code example(s) here showing the most common usage(s) | 
| 124 |  |  |  |  |  |  | # This section will be as far as many users bother reading, so make it as | 
| 125 |  |  |  |  |  |  | # educational and exemplary as possible. | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | =head1 SUBROUTINES/METHODS | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =head2 C<emails ()> | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =head2 C<from_branch ()> | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =head2 C<from_data ()> | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | =head2 C<from_name ()> | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =head2 C<from_project ()> | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | =head2 C<from_repository ()> | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =head2 C<to_branch ()> | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | =head2 C<to_data ()> | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =head2 C<to_name ()> | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =head2 C<to_project ()> | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =head2 C<to_repository ()> | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | =head2 C<TO_JSON ()> | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | Used by L<JSON::XS> for dumping the object | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | =head1 ATTRIBUTES | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =head2 state | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =head2 id | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | =head2 toRef | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | =head2 closed | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | =head2 version | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | =head2 attributes | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | =head2 open | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | =head2 fromRef | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | =head2 updatedDate | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | =head2 createdDate | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | =head2 title | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | =head2 links | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =head2 reviewers | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | =head2 participants | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | =head2 link | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | =head2 author | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | =head1 DIAGNOSTICS | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | =head1 CONFIGURATION AND ENVIRONMENT | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | =head1 DEPENDENCIES | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | =head1 INCOMPATIBILITIES | 
| 199 |  |  |  |  |  |  |  | 
| 200 |  |  |  |  |  |  | =head1 BUGS AND LIMITATIONS | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | There are no known bugs in this module. | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | Please report problems to Ivan Wills (ivan.wills@gmail.com). | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | Patches are welcome. | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | =head1 AUTHOR | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | Ivan Wills - (ivan.wills@gmail.com) | 
| 211 |  |  |  |  |  |  |  | 
| 212 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 213 |  |  |  |  |  |  |  | 
| 214 |  |  |  |  |  |  | Copyright (c) 2015 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). | 
| 215 |  |  |  |  |  |  | All rights reserved. | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | This module is free software; you can redistribute it and/or modify it under | 
| 218 |  |  |  |  |  |  | the same terms as Perl itself. See L<perlartistic>.  This program is | 
| 219 |  |  |  |  |  |  | distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | 
| 220 |  |  |  |  |  |  | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 
| 221 |  |  |  |  |  |  | PARTICULAR PURPOSE. | 
| 222 |  |  |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | =cut |