line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
# PODNAME: RT::Client::REST::Transaction |
3
|
|
|
|
|
|
|
# ABSTRACT: transaction object representation. |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
107460
|
use strict; |
|
3
|
|
|
|
|
22
|
|
|
3
|
|
|
|
|
87
|
|
6
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
160
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package RT::Client::REST::Transaction; |
9
|
|
|
|
|
|
|
$RT::Client::REST::Transaction::VERSION = '0.71'; |
10
|
3
|
|
|
3
|
|
493
|
use parent 'RT::Client::REST::Object'; |
|
3
|
|
|
|
|
299
|
|
|
3
|
|
|
|
|
15
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
201
|
use Params::Validate qw(:types); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
499
|
|
13
|
3
|
|
|
3
|
|
22
|
use RT::Client::REST::Object::Exception; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
44
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _attributes {{ |
16
|
3
|
|
|
3
|
|
88
|
id => { |
17
|
|
|
|
|
|
|
validation => { |
18
|
|
|
|
|
|
|
type => SCALAR, |
19
|
|
|
|
|
|
|
regex => qr/^\d+$/, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
creator => { |
24
|
|
|
|
|
|
|
validation => { |
25
|
|
|
|
|
|
|
type => SCALAR, |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
type => { |
30
|
|
|
|
|
|
|
validation => { |
31
|
|
|
|
|
|
|
type => SCALAR, |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
old_value => { |
36
|
|
|
|
|
|
|
validation => { |
37
|
|
|
|
|
|
|
type => SCALAR, |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
rest_name => "OldValue", |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
new_value => { |
43
|
|
|
|
|
|
|
validation => { |
44
|
|
|
|
|
|
|
type => SCALAR, |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
rest_name => "NewValue", |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
parent_id => { |
50
|
|
|
|
|
|
|
validation => { |
51
|
|
|
|
|
|
|
type => SCALAR, |
52
|
|
|
|
|
|
|
regex => qr/^\d+$/, |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
rest_name => 'Ticket', |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
attachments => { |
58
|
|
|
|
|
|
|
validation => { |
59
|
|
|
|
|
|
|
type => SCALAR, |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
}, |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
time_taken => { |
64
|
|
|
|
|
|
|
validation => { |
65
|
|
|
|
|
|
|
type => SCALAR, |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
rest_name => 'TimeTaken', |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
field => { |
71
|
|
|
|
|
|
|
validation => { |
72
|
|
|
|
|
|
|
type => SCALAR, |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
content => { |
77
|
|
|
|
|
|
|
validation => { |
78
|
|
|
|
|
|
|
type => SCALAR, |
79
|
|
|
|
|
|
|
}, |
80
|
|
|
|
|
|
|
}, |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
created => { |
83
|
|
|
|
|
|
|
validation => { |
84
|
|
|
|
|
|
|
type => SCALAR, |
85
|
|
|
|
|
|
|
}, |
86
|
|
|
|
|
|
|
is_datetime => 1, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
description => { |
90
|
|
|
|
|
|
|
validation => { |
91
|
|
|
|
|
|
|
type => SCALAR|UNDEF, |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
data => { |
96
|
|
|
|
|
|
|
validation => { |
97
|
|
|
|
|
|
|
type => SCALAR, |
98
|
|
|
|
|
|
|
}, |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
}} |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
1
|
1
|
1115
|
sub rt_type { 'transaction' } |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub retrieve { |
105
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
$self->from_form( |
108
|
|
|
|
|
|
|
$self->rt->get_transaction( |
109
|
|
|
|
|
|
|
parent_id => $self->parent_id, |
110
|
|
|
|
|
|
|
id => $self->id, |
111
|
|
|
|
|
|
|
), |
112
|
|
|
|
|
|
|
); |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
0
|
$self->{__dirty} = {}; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
0
|
return $self; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Override unsupported methods. |
120
|
|
|
|
|
|
|
for my $method (qw(store search count)) { |
121
|
3
|
|
|
3
|
|
1026
|
no strict 'refs'; ## no critic (ProhibitNoStrict) |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
361
|
|
122
|
|
|
|
|
|
|
*$method = sub { |
123
|
3
|
|
|
3
|
|
2989
|
my $self = shift; |
124
|
3
|
|
|
|
|
41
|
RT::Client::REST::Object::IllegalMethodException->throw( |
125
|
|
|
|
|
|
|
ref($self) . " does not support '$method' method", |
126
|
|
|
|
|
|
|
); |
127
|
|
|
|
|
|
|
}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__PACKAGE__->_generate_methods; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
__END__ |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=pod |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=encoding UTF-8 |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 NAME |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
RT::Client::REST::Transaction - transaction object representation. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 VERSION |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
version 0.71 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 SYNOPSIS |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
my $transactions = $ticket->transactions; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $count = $transactions->count; |
153
|
|
|
|
|
|
|
print "There are $count transactions.\n"; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
my $iterator = $transactions->get_iterator; |
156
|
|
|
|
|
|
|
while (my $tr = &$iterator) { |
157
|
|
|
|
|
|
|
print "Id: ", $tr->id, "; Type: ", $tr->type, "\n"; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 DESCRIPTION |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
A transaction is a second-class citizen, as it does not exist (at least |
163
|
|
|
|
|
|
|
from the current REST protocol implementation) by itself. At the moment, |
164
|
|
|
|
|
|
|
it is always associated with a ticket (see B<parent_id> attribute). |
165
|
|
|
|
|
|
|
Thus, you will |
166
|
|
|
|
|
|
|
rarely retrieve a transaction by itself; instead, you should use |
167
|
|
|
|
|
|
|
C<transactions()> method of L<RT::Client::REST::Ticket> object to get |
168
|
|
|
|
|
|
|
an iterator for all (or some) transactions for that ticket. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=over 2 |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item B<id> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Numeric ID of the transaction. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item B<creator> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Username of the user who created the transaction. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item B<parent_id> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Numeric ID of the object the transaction is associated with. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item B<type> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Type of the transactions. Please refer to L<RT::Client::REST> |
189
|
|
|
|
|
|
|
documentation for the list of transaction types you can expect this |
190
|
|
|
|
|
|
|
field to contain. Note that there may be some transaction types not |
191
|
|
|
|
|
|
|
(dis)covered yet. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item B<old_value> |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Old value. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item B<new_value> |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
New value. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item B<field> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Name of the field the transaction is describing (if any). |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item B<attachments> |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
I have never seen it set to anything yet. (I will some day investigate this). |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item B<created> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Time when the transaction was created. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item B<content> |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Actual content of the transaction. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item B<description> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Human-readable description of the transaction as provided by RT. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item B<data> |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Not sure what this is yet. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=back |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 METHODS |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
B<RT::Client::REST::Transaction> is a read-only object, so you cannot |
230
|
|
|
|
|
|
|
C<store()> it. Also, because it is a second-class citizen, you cannot |
231
|
|
|
|
|
|
|
C<search()> or C<count()> it -- use C<transactions()> method provided |
232
|
|
|
|
|
|
|
by L<RT::Client::REST::Ticket>. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=over 2 |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item retrieve |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
To retrieve a transaction, attributes B<id> and B<parent_id> must be set. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=back |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 INTERNAL METHODS |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=over 2 |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=item B<rt_type> |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Returns 'transaction'. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=back |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head1 SEE ALSO |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
L<RT::Client::REST>, |
255
|
|
|
|
|
|
|
L<RT::Client::REST::Ticket>, |
256
|
|
|
|
|
|
|
L<RT::Client::REST::SearchResult>. |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head1 AUTHOR |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Dean Hamstead <dean@fragfest.com.au> |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2020 by Dmitri Tikhonov. |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
267
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |