File Coverage

lib/JIRA/REST/Class/Issue/Transitions/Transition.pm
Criterion Covered Total %
statement 11 20 55.0
branch n/a
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 17 28 60.7


line stmt bran cond sub pod time code
1             package JIRA::REST::Class::Issue::Transitions::Transition;
2 4     4   1856 use parent qw( JIRA::REST::Class::Abstract );
  4         11  
  4         19  
3 4     4   255 use strict;
  4         6  
  4         65  
4 4     4   16 use warnings;
  4         8  
  4         74  
5 4     4   50 use 5.010;
  4         13  
6              
7             our $VERSION = '0.11';
8             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             __PACKAGE__->mk_ro_accessors( qw/ issue to / );
15             __PACKAGE__->mk_data_ro_accessors( qw/ id name hasScreen fields / );
16             __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             sub init {
51 0     0 1   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             sub go {
66 0     0 1   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             1;
86              
87             __END__
88              
89             =pod
90              
91             =encoding UTF-8
92              
93             =for :stopwords Packy Anderson Alexandr Alexey Ciornii Melezhik hasScreen
94              
95             =head1 NAME
96              
97             JIRA::REST::Class::Issue::Transitions::Transition - A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents an individual state transition a JIRA issue can go through.
98              
99             =head1 VERSION
100              
101             version 0.11
102              
103             =head1 METHODS
104              
105             =head2 B<go>
106              
107             Perform the transition represented by this object on the issue.
108              
109             =head1 READ-ONLY ACCESSORS
110              
111             =head2 B<issue>
112              
113             The L<JIRA::REST::Class::Issue|JIRA::REST::Class::Issue> object this is a
114             transition for.
115              
116             =head2 B<to>
117              
118             The status this transition will move the issue to, represented as a
119             L<JIRA::REST::Class::Issue::Status|JIRA::REST::Class::Issue::Status> object.
120              
121             =head2 B<id>
122              
123             The id of the transition.
124              
125             =head2 B<>
126              
127             The name of the transition.
128              
129             =head2 B<fields>
130              
131             The fields for the transition.
132              
133             =head2 B<summary>
134              
135             The summary for the transition.
136              
137             =head2 B<hasScreen>
138              
139             Heck if I know.
140              
141             =head1 RELATED CLASSES
142              
143             =over 2
144              
145             =item * L<JIRA::REST::Class|JIRA::REST::Class>
146              
147             =item * L<JIRA::REST::Class::Abstract|JIRA::REST::Class::Abstract>
148              
149             =item * L<JIRA::REST::Class::Issue|JIRA::REST::Class::Issue>
150              
151             =item * L<JIRA::REST::Class::Issue::Status|JIRA::REST::Class::Issue::Status>
152              
153             =back
154              
155             =head1 AUTHOR
156              
157             Packy Anderson <packy@cpan.org>
158              
159             =head1 COPYRIGHT AND LICENSE
160              
161             This software is Copyright (c) 2017 by Packy Anderson.
162              
163             This is free software, licensed under:
164              
165             The Artistic License 2.0 (GPL Compatible)
166              
167             =cut