File Coverage

blib/lib/RT/Client/REST/Group.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::Group
3             # ABSTRACT: group object representation.
4              
5 1     1   106574 use strict;
  1         10  
  1         28  
6 1     1   5 use warnings;
  1         2  
  1         45  
7              
8             package RT::Client::REST::Group;
9             $RT::Client::REST::Group::VERSION = '0.72';
10 1     1   434 use parent 'RT::Client::REST::Object';
  1         291  
  1         5  
11              
12 1     1   51 use Params::Validate qw(:types);
  1         2  
  1         185  
13 1     1   632 use RT::Client::REST;
  1         14  
  1         36  
14 1     1   7 use RT::Client::REST::Object::Exception;
  1         2  
  1         16  
15 1     1   67 use RT::Client::REST::SearchResult;
  1         2  
  1         207  
16              
17              
18             sub _attributes {{
19             id => {
20             validation => {
21             type => SCALAR,
22             },
23             form2value => sub {
24 0     0   0 shift =~ m~^group/(\d+)$~i;
25 0         0 return $1;
26             },
27             value2form => sub {
28 0     0   0 return 'group/' . shift;
29             },
30             },
31              
32 1     1   33 name => {
33             validation => {
34             type => SCALAR,
35             },
36             },
37             description => {
38             validation => {
39             type => SCALAR,
40             },
41             },
42             members => {
43             validation => {
44             type => ARRAYREF,
45             },
46             list => 1,
47             },
48             disabled => {
49             validation => {
50             type => SCALAR,
51             },
52             },
53             }}
54              
55              
56 1     1 1 3395 sub rt_type { 'group' }
57              
58              
59             __PACKAGE__->_generate_methods;
60              
61             1;
62              
63             __END__
64              
65             =pod
66              
67             =encoding UTF-8
68              
69             =head1 NAME
70              
71             RT::Client::REST::Group - group object representation.
72              
73             =head1 VERSION
74              
75             version 0.72
76              
77             =head1 SYNOPSIS
78              
79             my $rt = RT::Client::REST->new(server => $ENV{RTSERVER});
80              
81             my $group = RT::Client::REST::Group->new(
82             rt => $rt,
83             id => $id,
84             )->retrieve;
85              
86             =head1 DESCRIPTION
87              
88             B<RT::Client::REST::Group> is based on L<RT::Client::REST::Object>.
89             The representation allows one to retrieve, edit, and create groups in RT.
90              
91             Note: RT currently does not allow REST client to search groups.
92              
93             =head1 ATTRIBUTES
94              
95             =over 2
96              
97             =item B<id>
98              
99             For retrieval, you can specify either the numeric ID of the group or his
100             group name. After the retrieval, however, this attribute will be set
101             to the numeric id.
102              
103             =item B<name>
104              
105             Name of the group
106              
107             =item B<description>
108              
109             Description
110              
111             =item B<members>
112              
113             List of the members of this group.
114              
115             =back
116              
117             =head1 DB METHODS
118              
119             For full explanation of these, please see B<"DB METHODS"> in
120             L<RT::Client::REST::Object> documentation.
121              
122             =over 2
123              
124             =item B<retrieve>
125              
126             Retrieve RT group from database.
127              
128             =item B<store>
129              
130             Create or update the group.
131              
132             =item B<search>
133              
134             Currently RT does not allow REST clients to search groups.
135              
136             =back
137              
138             =head1 INTERNAL METHODS
139              
140             =over 2
141              
142             =item B<rt_type>
143              
144             Returns 'group'.
145              
146             =back
147              
148             =head1 SEE ALSO
149              
150             L<RT::Client::REST>, L<RT::Client::REST::Object>,
151             L<RT::Client::REST::SearchResult>.
152              
153             =head1 AUTHOR
154              
155             Dean Hamstead <dean@fragfest.com.au>
156              
157             =head1 COPYRIGHT AND LICENSE
158              
159             This software is copyright (c) 2023, 2020 by Dmitri Tikhonov.
160              
161             This is free software; you can redistribute it and/or modify it under
162             the same terms as the Perl 5 programming language system itself.
163              
164             =cut