| 1 | package Google::RestApi::DriveApi3::Reply; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | our $VERSION = '1.1.0'; | |||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use Google::RestApi::Setup; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use parent 'Google::RestApi::SubResource'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 7 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | 7 | my $class = shift; | |||||||||
| 11 | 7 | state $check = signature( | |||||||||
| 12 | bless => !!0, | ||||||||||
| 13 | named => [ | ||||||||||
| 14 | comment => HasApi, | ||||||||||
| 15 | id => Str, { optional => 1 }, | ||||||||||
| 16 | ], | ||||||||||
| 17 | ); | ||||||||||
| 18 | 7 | return bless $check->(@_), $class; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 2 | ▶ | sub _uri_base { 'replies' } | ||||||||
|
Subroutine
_uri_base: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 2 | ▶ | sub _parent_accessor { 'comment' } | ||||||||
|
Subroutine
_parent_accessor: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | sub create { | ||||||||
|
Subroutine
create: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 25 | 1 | my $self = shift; | |||||||||
| 26 | 1 | state $check = signature( | |||||||||
| 27 | bless => !!0, | ||||||||||
| 28 | named => [ | ||||||||||
| 29 | content => Str, | ||||||||||
| 30 | action => Str, { optional => 1 }, | ||||||||||
| 31 | _extra_ => slurpy HashRef, | ||||||||||
| 32 | ], | ||||||||||
| 33 | ); | ||||||||||
| 34 | 1 | my $p = named_extra($check->(@_)); | |||||||||
| 35 | |||||||||||
| 36 | my %content = ( | ||||||||||
| 37 | content => delete $p->{content}, | ||||||||||
| 38 | 1 | ); | |||||||||
| 39 | 1 | ▶ | $content{action} = delete $p->{action} if defined $p->{action}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | |||||||||||
| 41 | 1 | DEBUG(sprintf("Creating reply on comment '%s'", $self->comment()->comment_id())); | |||||||||
| 42 | 1 | my $result = $self->comment()->api( | |||||||||
| 43 | uri => 'replies', | ||||||||||
| 44 | method => 'post', | ||||||||||
| 45 | params => { fields => 'id, content, author, createdTime' }, | ||||||||||
| 46 | content => \%content, | ||||||||||
| 47 | ); | ||||||||||
| 48 | 1 | return ref($self)->new(comment => $self->comment(), id => $result->{id}); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 2 | ▶ | sub get { | ||||||||
|
Subroutine
get: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 52 | 2 | my $self = shift; | |||||||||
| 53 | 2 | state $check = signature( | |||||||||
| 54 | bless => !!0, | ||||||||||
| 55 | named => [ | ||||||||||
| 56 | fields => Str, { default => 'id,content,author,createdTime,modifiedTime' }, | ||||||||||
| 57 | include_deleted => Bool, { default => 0 }, | ||||||||||
| 58 | ], | ||||||||||
| 59 | ); | ||||||||||
| 60 | 2 | my $p = $check->(@_); | |||||||||
| 61 | |||||||||||
| 62 | 2 | $self->require_id('get'); | |||||||||
| 63 | |||||||||||
| 64 | my %params = ( | ||||||||||
| 65 | fields => $p->{fields}, | ||||||||||
| 66 | 1 | ); | |||||||||
| 67 | 1 | ▶ | $params{includeDeleted} = $p->{include_deleted} ? 'true' : 'false'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | |||||||||||
| 69 | 1 | return $self->api(params => \%params); | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 1 | ▶ | sub update { | ||||||||
|
Subroutine
update: called CC=1 SCAR=0.8
Pod
documented
| |||||||||||
| 73 | 1 | my $self = shift; | |||||||||
| 74 | 1 | state $check = signature( | |||||||||
| 75 | bless => !!0, | ||||||||||
| 76 | named => [ | ||||||||||
| 77 | content => Str, | ||||||||||
| 78 | _extra_ => slurpy HashRef, | ||||||||||
| 79 | ], | ||||||||||
| 80 | ); | ||||||||||
| 81 | 1 | my $p = named_extra($check->(@_)); | |||||||||
| 82 | |||||||||||
| 83 | 1 | $self->require_id('update'); | |||||||||
| 84 | |||||||||||
| 85 | my %content = ( | ||||||||||
| 86 | content => delete $p->{content}, | ||||||||||
| 87 | 0 | ); | |||||||||
| 88 | |||||||||||
| 89 | 0 | DEBUG(sprintf("Updating reply '%s'", $self->{id})); | |||||||||
| 90 | 0 | return $self->api( | |||||||||
| 91 | method => 'patch', | ||||||||||
| 92 | content => \%content, | ||||||||||
| 93 | ); | ||||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 2 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 97 | 2 | my $self = shift; | |||||||||
| 98 | |||||||||||
| 99 | 2 | $self->require_id('delete'); | |||||||||
| 100 | |||||||||||
| 101 | 1 | DEBUG(sprintf("Deleting reply '%s'", $self->{id})); | |||||||||
| 102 | 1 | return $self->api(method => 'delete'); | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | 1 | ▶ | sub reply_id { shift->{id}; } | ||||||||
|
Subroutine
reply_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 106 | 7 | ▶ | sub comment { shift->{comment}; } | ||||||||
|
Subroutine
comment: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 107 | 1 | ▶ | sub file { shift->comment()->file(); } | ||||||||
|
Subroutine
file: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 108 | |||||||||||
| 109 | 2 | 1; | |||||||||
| 110 | |||||||||||
| 111 | __END__ | ||||||||||