line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::Fixflo::IssueDraft; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Fixflo::IssueDraft |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A class for a fixflo issue draft, extends L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
16
|
|
|
16
|
|
127
|
use strict; |
|
16
|
|
|
|
|
40
|
|
|
16
|
|
|
|
|
611
|
|
14
|
16
|
|
|
16
|
|
92
|
use warnings; |
|
16
|
|
|
|
|
39
|
|
|
16
|
|
|
|
|
525
|
|
15
|
|
|
|
|
|
|
|
16
|
16
|
|
|
16
|
|
117
|
use Moo; |
|
16
|
|
|
|
|
46
|
|
|
16
|
|
|
|
|
104
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
extends 'Business::Fixflo::Issue'; |
19
|
|
|
|
|
|
|
with 'Business::Fixflo::Utils'; |
20
|
|
|
|
|
|
|
|
21
|
16
|
|
|
16
|
|
7073
|
use Business::Fixflo::Address; |
|
16
|
|
|
|
|
51
|
|
|
16
|
|
|
|
|
7600
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Updated |
26
|
|
|
|
|
|
|
IssueDraftMedia |
27
|
|
|
|
|
|
|
IssueTitle |
28
|
|
|
|
|
|
|
FirstName # note inconsistent with Issue (Firstname) |
29
|
|
|
|
|
|
|
# however Firstname will be set using an around modifier |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has [ qw/ |
34
|
|
|
|
|
|
|
Updated |
35
|
|
|
|
|
|
|
IssueDraftMedia |
36
|
|
|
|
|
|
|
IssueTitle |
37
|
|
|
|
|
|
|
PropertyId |
38
|
|
|
|
|
|
|
ExternalPropertyRef |
39
|
|
|
|
|
|
|
FirstName |
40
|
|
|
|
|
|
|
/ ] => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 Operations on a issue draft |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 create |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Creates an issue draft in the Fixflo API |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 update |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Updates an issue draft in the Fixflo API - will throw an exception if the Id |
53
|
|
|
|
|
|
|
is not set |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 commit |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Commits the issue draft, returning a Business::Fixflo::Issue object |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 delete |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Deletes the issue draft. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# IssueDraft has Firstname, whereas Issue has Firstname, so let's set |
66
|
|
|
|
|
|
|
# Firstname whenever FirstName is set so we can just use Firstname as |
67
|
|
|
|
|
|
|
# an accessor to be consistent |
68
|
|
|
|
|
|
|
after FirstName => sub { |
69
|
|
|
|
|
|
|
my ( $self,$value ) = @_; |
70
|
|
|
|
|
|
|
$self->Firstname( $value ); |
71
|
|
|
|
|
|
|
return; |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub create { |
75
|
5
|
|
|
5
|
1
|
57
|
my ( $self,$update ) = @_; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$self->SUPER::_create( $update,'IssueDraft',sub { |
78
|
3
|
|
|
3
|
|
5
|
my ( $self ) = @_; |
79
|
|
|
|
|
|
|
|
80
|
3
|
100
|
|
|
|
12
|
$self->Id or $self->Id( undef ); # force null in JSON request |
81
|
|
|
|
|
|
|
|
82
|
3
|
|
|
|
|
9
|
my $post_data = { $self->to_hash }; |
83
|
|
|
|
|
|
|
|
84
|
3
|
50
|
|
|
|
12
|
if ( $self->Address ) { |
85
|
0
|
0
|
|
|
|
0
|
$post_data->{Address} = ref( $self->Address ) eq 'HASH' |
86
|
|
|
|
|
|
|
? $self->Address |
87
|
|
|
|
|
|
|
: { $self->Address->to_hash }; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
3
|
|
|
|
|
7
|
return $post_data; |
91
|
5
|
|
|
|
|
35
|
} ); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub commit { |
95
|
1
|
|
|
1
|
1
|
4
|
my ( $self ) = @_; |
96
|
|
|
|
|
|
|
|
97
|
1
|
50
|
|
|
|
6
|
Business::Fixflo::Exception->throw({ |
98
|
|
|
|
|
|
|
message => "Can't commit IssueDraft if Id is not set", |
99
|
|
|
|
|
|
|
}) if ! $self->Id; |
100
|
|
|
|
|
|
|
|
101
|
1
|
|
|
|
|
5
|
my $post_data = { Id => $self->Id }; |
102
|
|
|
|
|
|
|
|
103
|
1
|
|
|
|
|
8
|
return Business::Fixflo::Issue->new( |
104
|
|
|
|
|
|
|
client => $self->client, |
105
|
|
|
|
|
|
|
)->_parse_envelope_data( |
106
|
|
|
|
|
|
|
$self->client->api_post( 'IssueDraft/Commit',$post_data ) |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub delete { |
111
|
1
|
|
|
1
|
1
|
4
|
my ( $self ) = @_; |
112
|
|
|
|
|
|
|
|
113
|
1
|
50
|
|
|
|
7
|
Business::Fixflo::Exception->throw({ |
114
|
|
|
|
|
|
|
message => "Can't delete IssueDraft if Id is not set", |
115
|
|
|
|
|
|
|
}) if ! $self->Id; |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
|
|
5
|
my $post_data = { Id => $self->Id }; |
118
|
|
|
|
|
|
|
|
119
|
1
|
|
|
|
|
5
|
return $self->_parse_envelope_data( |
120
|
|
|
|
|
|
|
$self->client->api_post( 'IssueDraft/Delete',$post_data ) |
121
|
|
|
|
|
|
|
); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Lee Johnson - C |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
129
|
|
|
|
|
|
|
the same terms as Perl itself. If you would like to contribute documentation, |
130
|
|
|
|
|
|
|
features, bug fixes, or anything else then please raise an issue / pull request: |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
https://github.com/Humanstate/business-fixflo |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# vim: ts=4:sw=4:et |