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