| 1 | package JIRA::REST::Class::Issue::Transitions::Transition; | ||
| 2 | 4 | ▶ | use parent qw( JIRA::REST::Class::Abstract ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 4 | our $VERSION = '0.12'; | |
| 8 | 4 | our $SOURCE = 'CPAN'; | |
| 9 | ## $SOURCE = 'GitHub'; # COMMENT | ||
| 10 | # the line above will be commented out by Dist::Zilla | ||
| 11 | |||
| 12 | # ABSTRACT: A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents an individual state transition a JIRA issue can go through. | ||
| 13 | |||
| 14 | 4 | __PACKAGE__->mk_ro_accessors( qw/ issue to / ); | |
| 15 | 4 | __PACKAGE__->mk_data_ro_accessors( qw/ id name hasScreen fields / ); | |
| 16 | 4 | __PACKAGE__->mk_field_ro_accessors( qw/ summary / ); | |
| 17 | |||
| 18 | #pod =accessor B<issue> | ||
| 19 | #pod | ||
| 20 | #pod The L<JIRA::REST::Class::Issue|JIRA::REST::Class::Issue> object this is a | ||
| 21 | #pod transition for. | ||
| 22 | #pod | ||
| 23 | #pod =accessor B<to> | ||
| 24 | #pod | ||
| 25 | #pod The status this transition will move the issue to, represented as a | ||
| 26 | #pod L<JIRA::REST::Class::Issue::Status|JIRA::REST::Class::Issue::Status> object. | ||
| 27 | #pod | ||
| 28 | #pod =accessor B<id> | ||
| 29 | #pod | ||
| 30 | #pod The id of the transition. | ||
| 31 | #pod | ||
| 32 | #pod =accessor B<> | ||
| 33 | #pod | ||
| 34 | #pod The name of the transition. | ||
| 35 | #pod | ||
| 36 | #pod =accessor B<fields> | ||
| 37 | #pod | ||
| 38 | #pod The fields for the transition. | ||
| 39 | #pod | ||
| 40 | #pod =accessor B<summary> | ||
| 41 | #pod | ||
| 42 | #pod The summary for the transition. | ||
| 43 | #pod | ||
| 44 | #pod =accessor B<hasScreen> | ||
| 45 | #pod | ||
| 46 | #pod Heck if I know. | ||
| 47 | #pod | ||
| 48 | #pod =cut | ||
| 49 | |||
| 50 | 0 | ▶ | sub init { |
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 51 | 0 | my $self = shift; | |
| 52 | 0 | $self->SUPER::init( @_ ); | |
| 53 | |||
| 54 | 0 | $self->{to} = $self->make_object( 'status', { data => $self->data->{to} } ); | |
| 55 | |||
| 56 | 0 | return; | |
| 57 | } | ||
| 58 | |||
| 59 | #pod =method B<go> | ||
| 60 | #pod | ||
| 61 | #pod Perform the transition represented by this object on the issue. | ||
| 62 | #pod | ||
| 63 | #pod =cut | ||
| 64 | |||
| 65 | 0 | ▶ | sub go { |
|
Subroutine
go: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 66 | 0 | my ( $self, @args ) = @_; | |
| 67 | 0 | $self->issue->post( | |
| 68 | '/transitions', | ||
| 69 | { | ||
| 70 | transition => { id => $self->id }, | ||
| 71 | @args | ||
| 72 | } | ||
| 73 | ); | ||
| 74 | |||
| 75 | # reload the issue itself, since it's going to have a new status, | ||
| 76 | # which will mean new transitions | ||
| 77 | 0 | $self->issue->reload; | |
| 78 | |||
| 79 | # reload these new transitions | ||
| 80 | 0 | $self->issue->transitions->init( $self->factory ); | |
| 81 | |||
| 82 | 0 | return; | |
| 83 | } | ||
| 84 | |||
| 85 | 4 | 1; | |
| 86 | |||
| 87 | __END__ | ||