File Coverage

blib/lib/RT/Client/REST/User.pm
Criterion Covered Total %
statement 23 26 88.4
branch n/a
condition n/a
subroutine 9 11 81.8
pod 1 1 100.0
total 33 38 86.8


line stmt bran cond sub pod time code
1             #!perl
2             # PODNAME: RT::Client::REST::User
3             # ABSTRACT: user object representation.
4              
5 1     1   92731 use strict;
  1         17  
  1         24  
6 1     1   5 use warnings;
  1         1  
  1         37  
7              
8             $RT::Client::REST::User::VERSION = '0.70';
9             use parent 'RT::Client::REST::Object';
10 1     1   412  
  1         249  
  1         4  
11             use Params::Validate qw(:types);
12 1     1   44 use RT::Client::REST;
  1         1  
  1         156  
13 1     1   498 use RT::Client::REST::Object::Exception;
  1         11  
  1         30  
14 1     1   6 use RT::Client::REST::SearchResult;
  1         1  
  1         14  
15 1     1   47  
  1         1  
  1         277  
16              
17             id => {
18             validation => {
19             type => SCALAR,
20             },
21             form2value => sub {
22             shift =~ m~^user/(\d+)$~i;
23             return $1;
24 0     0   0 },
25 0         0 value2form => sub {
26             return 'user/' . shift;
27             },
28 0     0   0 },
29              
30              
31             privileged => {
32             validation => {
33 1     1   32 type => SCALAR,
34             },
35             },
36             disabled => {
37             validation => {
38             type => SCALAR,
39             },
40             },
41             name => {
42             validation => {
43             type => SCALAR,
44             },
45             },
46             password => {
47             validation => {
48             type => SCALAR,
49             },
50             },
51             email_address => {
52             validation => {
53             type => SCALAR,
54             },
55             rest_name => 'EmailAddress',
56             },
57             real_name => {
58             validation => {
59             type => SCALAR,
60             },
61             rest_name => 'RealName',
62             },
63             gecos => {
64             validation => {
65             type => SCALAR,
66             },
67             },
68             comments => {
69             validation => {
70             type => SCALAR,
71             },
72             },
73             nickname => {
74             validation => {
75             type => SCALAR,
76             },
77             },
78             lang => {
79             validation => {
80             type => SCALAR,
81             },
82             },
83             contactinfo => {
84             validation => {
85             type => SCALAR,
86             },
87             },
88             signature => {
89             validation => {
90             type => SCALAR,
91             },
92             },
93              
94              
95             organization => {
96             validation => {
97             type => SCALAR,
98             },
99             },
100             address_one => {
101             validation => {
102             type => SCALAR,
103             },
104             rest_name => 'Address1',
105             },
106             address_two => {
107             validation => {
108             type => SCALAR,
109             },
110             rest_name => 'Address2',
111             },
112             city => {
113             validation => {
114             type => SCALAR,
115             },
116             },
117             state => {
118             validation => {
119             type => SCALAR,
120             },
121             },
122             zip => {
123             validation => {
124             type => SCALAR,
125             },
126             },
127             country => {
128             validation => {
129             type => SCALAR,
130             },
131             },
132              
133              
134             home_phone => {
135             validation => {
136             type => SCALAR,
137             },
138             rest_name => 'HomePhone',
139             },
140             work_phone => {
141             validation => {
142             type => SCALAR,
143             },
144             rest_name => 'WorkPhone',
145             },
146             cell_phone => {
147             validation => {
148             type => SCALAR,
149             },
150             rest_name => 'MobilePhone',
151             },
152             pager => {
153             validation => {
154             type => SCALAR,
155             },
156             rest_name => 'PagerPhone',
157             },
158             }}
159              
160              
161              
162              
163 1     1 1 8265 __PACKAGE__->_generate_methods;
164              
165             1;
166              
167              
168             =pod
169              
170             =encoding UTF-8
171              
172             =head1 NAME
173              
174             RT::Client::REST::User - user object representation.
175              
176             =head1 VERSION
177              
178             version 0.70
179              
180             =head1 SYNOPSIS
181              
182             my $rt = RT::Client::REST->new(server => $ENV{RTSERVER});
183              
184             my $user = RT::Client::REST::User->new(
185             rt => $rt,
186             id => $id,
187             )->retrieve;
188              
189             =head1 DESCRIPTION
190              
191             B<RT::Client::REST::User> is based on L<RT::Client::REST::Object>.
192             The representation allows one to retrieve, edit, comment on, and create
193             users in RT.
194              
195             Note: RT currently does not allow REST client to search users.
196              
197             =for stopwords EmailAddress gecos Gecos HomePhone MobilePhone PagerPhone RealName WorkPhone
198              
199             =head1 ATTRIBUTES
200              
201             =over 2
202              
203             =item B<id>
204              
205             For retrieval, you can specify either the numeric ID of the user or his
206             username. After the retrieval, however, this attribute will be set
207             to the numeric id.
208              
209             =item B<name>
210              
211             This is the username of the user.
212              
213             =item B<password>
214              
215             User's password. Reading it will only give you a bunch of stars (what
216             else would you expect?).
217              
218             =item B<privileged>
219              
220             Can the user have special rights?
221              
222             =item B<disabled>
223              
224             Can this user access RT?
225              
226             =item B<email_address>
227              
228             E-mail address of the user, EmailAddress.
229              
230             =item B<real_name>
231              
232             Real name of the user, RealName.
233              
234             =item B<gecos>
235              
236             Gecos.
237              
238             =item B<comments>
239              
240             Comments about this user.
241              
242             =item B<nickname>
243              
244             Nickname of this user.
245              
246             =for stopwords lang
247              
248             =item B<lang>
249              
250             Language for this user.
251              
252             =item B<organization>
253              
254             =item B<address_one>
255              
256             First line of the street address, Address1.
257              
258             =item B<address_two>
259              
260             Second line of the street address, Address2.
261              
262             =item B<city>
263              
264             City segment of user's address.
265              
266             =item B<zip>
267              
268             ZIP or Postal code segment of user's address.
269              
270             =item B<country>
271              
272             Country segment of user's address.
273              
274             =item B<home_phone>
275              
276             User's home phone number, HomePhone.
277              
278             =item B<work_phone>
279              
280             User's work phone number, WorkPhone.
281              
282             =item B<cell_phone>
283              
284             User's cell phone number, MobilePhone.
285              
286             =item B<pager>
287              
288             User's pager number, PagerPhone.
289              
290             =for stopwords contactinfo
291              
292             =item B<contactinfo>
293              
294             Contact info (Extra Info field).
295              
296             =item B<signature>
297              
298             Signature for the user.
299              
300             =back
301              
302             =head1 DB METHODS
303              
304             For full explanation of these, please see B<"DB METHODS"> in
305             L<RT::Client::REST::Object> documentation.
306              
307             =over 2
308              
309             =item B<retrieve>
310              
311             Retrieve RT user from database.
312              
313             =item B<store>
314              
315             Create or update the user.
316              
317             =item B<search>
318              
319             Currently RT does not allow REST clients to search users.
320              
321             =back
322              
323             =head1 INTERNAL METHODS
324              
325             =over 2
326              
327             =item B<rt_type>
328              
329             Returns 'user'.
330              
331             =back
332              
333             =head1 SEE ALSO
334              
335             L<RT::Client::REST>, L<RT::Client::REST::Object>,
336             L<RT::Client::REST::SearchResult>.
337              
338             =head1 AUTHOR
339              
340             Dean Hamstead <dean@fragfest.com.au>
341              
342             =head1 COPYRIGHT AND LICENSE
343              
344             This software is copyright (c) 2022, 2020 by Dmitri Tikhonov.
345              
346             This is free software; you can redistribute it and/or modify it under
347             the same terms as the Perl 5 programming language system itself.
348              
349             =cut