line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Representation of a single Duo group for the Admin API. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This class wraps the Duo representation of a single Duo group, as returned |
4
|
|
|
|
|
|
|
# by (for example) the Admin /groups REST endpoint. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Net::Duo::Admin::Group 1.01; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
7677
|
use 5.014; |
|
6
|
|
|
|
|
20
|
|
9
|
6
|
|
|
6
|
|
31
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
159
|
|
10
|
6
|
|
|
6
|
|
29
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
182
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
3368
|
use parent qw(Net::Duo::Object); |
|
6
|
|
|
|
|
1393
|
|
|
6
|
|
|
|
|
32
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Data specification for converting JSON into our object representation. See |
15
|
|
|
|
|
|
|
# the Net::Duo::Object documentation for syntax information. |
16
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
17
|
|
|
|
|
|
|
sub _fields { |
18
|
|
|
|
|
|
|
return { |
19
|
13
|
|
|
13
|
|
118
|
desc => 'simple', |
20
|
|
|
|
|
|
|
group_id => 'simple', |
21
|
|
|
|
|
|
|
name => 'simple', |
22
|
|
|
|
|
|
|
push_enabled => ['simple', 'boolean'], |
23
|
|
|
|
|
|
|
sms_enabled => ['simple', 'boolean'], |
24
|
|
|
|
|
|
|
status => 'simple', |
25
|
|
|
|
|
|
|
voice_enabled => ['simple', 'boolean'], |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
## use critic |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Install our accessors. |
31
|
|
|
|
|
|
|
Net::Duo::Admin::Group->install_accessors; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Override the create method to add the appropriate URI. |
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# $class - Class of object to create |
36
|
|
|
|
|
|
|
# $duo - Net::Duo object to use to create the object |
37
|
|
|
|
|
|
|
# $data_ref - Data for new object as a reference to a hash |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# Returns: Newly-created object |
40
|
|
|
|
|
|
|
# Throws: Net::Duo::Exception on any problem creating the object |
41
|
|
|
|
|
|
|
sub create { |
42
|
1
|
|
|
1
|
1
|
98
|
my ($class, $duo, $data_ref) = @_; |
43
|
1
|
|
|
|
|
10
|
return $class->SUPER::create($duo, '/admin/v1/groups', $data_ref); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Delete the group from Duo. After this call, the object should be treated as |
47
|
|
|
|
|
|
|
# read-only since it can no longer be usefully updated. |
48
|
|
|
|
|
|
|
# |
49
|
|
|
|
|
|
|
# $self - The Net::Duo::Admin::Group object to delete |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# Returns: undef |
52
|
|
|
|
|
|
|
# Throws: Net::Duo::Exception on any problem deleting the object |
53
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitBuiltinHomonyms) |
54
|
|
|
|
|
|
|
sub delete { |
55
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
56
|
1
|
|
|
|
|
9
|
$self->{_duo}->call_json('DELETE', "/admin/v1/groups/$self->{group_id}"); |
57
|
1
|
|
|
|
|
4
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
## use critic |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |