| 1 | 9 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Net::Etcd::User; | ||||||||||
| 3 | |||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 9 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 9 | ▶ | use Net::Etcd::User::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 9 | ▶ | use Types::Standard qw(Str Int Bool HashRef ArrayRef); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 9 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 9 | with 'Net::Etcd::Role::Actions'; | |||||||||
| 14 | |||||||||||
| 15 | 9 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | =head1 NAME | ||||||||||
| 18 | |||||||||||
| 19 | Net::Etcd::User | ||||||||||
| 20 | |||||||||||
| 21 | =cut | ||||||||||
| 22 | |||||||||||
| 23 | 9 | our $VERSION = '0.022'; | |||||||||
| 24 | |||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||
| 26 | |||||||||||
| 27 | User class | ||||||||||
| 28 | |||||||||||
| 29 | =cut | ||||||||||
| 30 | |||||||||||
| 31 | =head1 ACCESSORS | ||||||||||
| 32 | |||||||||||
| 33 | =head2 endpoint | ||||||||||
| 34 | |||||||||||
| 35 | =cut | ||||||||||
| 36 | |||||||||||
| 37 | 9 | has endpoint => ( | |||||||||
| 38 | is => 'rwp', | ||||||||||
| 39 | isa => Str, | ||||||||||
| 40 | ); | ||||||||||
| 41 | |||||||||||
| 42 | =head2 name | ||||||||||
| 43 | |||||||||||
| 44 | name of user | ||||||||||
| 45 | |||||||||||
| 46 | =cut | ||||||||||
| 47 | |||||||||||
| 48 | 9 | has name => ( | |||||||||
| 49 | is => 'ro', | ||||||||||
| 50 | isa => Str, | ||||||||||
| 51 | required => 1, | ||||||||||
| 52 | ); | ||||||||||
| 53 | |||||||||||
| 54 | =head2 password | ||||||||||
| 55 | |||||||||||
| 56 | =cut | ||||||||||
| 57 | |||||||||||
| 58 | 9 | has password => ( | |||||||||
| 59 | is => 'ro', | ||||||||||
| 60 | isa => Str, | ||||||||||
| 61 | ); | ||||||||||
| 62 | |||||||||||
| 63 | =head1 PUBLIC METHODS | ||||||||||
| 64 | |||||||||||
| 65 | =head2 add | ||||||||||
| 66 | |||||||||||
| 67 | $etcd->user({ name =>'foo' password => 'bar' })->add | ||||||||||
| 68 | |||||||||||
| 69 | =cut | ||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | sub add { | ||||||||
|
Subroutine
add: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 72 | 0 | my $self = shift; | |||||||||
| 73 | 0 | $self->{endpoint} = '/auth/user/add'; | |||||||||
| 74 | confess 'password required for ' . __PACKAGE__ . '->add' | ||||||||||
| 75 | 0 | ▶ | unless $self->{password}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | 0 | $self->request; | |||||||||
| 77 | 0 | return $self; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | =head2 delete | ||||||||||
| 81 | |||||||||||
| 82 | $etcd->user({ name =>'foo' })->delete | ||||||||||
| 83 | |||||||||||
| 84 | =cut | ||||||||||
| 85 | |||||||||||
| 86 | 0 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 87 | 0 | my $self = shift; | |||||||||
| 88 | 0 | $self->{endpoint} = '/auth/user/delete'; | |||||||||
| 89 | 0 | $self->request; | |||||||||
| 90 | 0 | return $self; | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | =head2 changepw | ||||||||||
| 95 | |||||||||||
| 96 | $etcd->user({ name =>'foo' password => 'bar' })->changepw | ||||||||||
| 97 | |||||||||||
| 98 | =cut | ||||||||||
| 99 | |||||||||||
| 100 | 0 | ▶ | sub changepw { | ||||||||
|
Subroutine
changepw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 101 | 0 | my $self = shift; | |||||||||
| 102 | 0 | $self->{endpoint} = '/auth/user/changepw'; | |||||||||
| 103 | 0 | $self->request; | |||||||||
| 104 | 0 | return $self; | |||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | 9 | 1; | |||||||||