| 1 | package WebService::Netlify; | ||||||||||||||||||||||||||||
| 2 | 2 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||
| 3 | 2 | ▶ | use v5.26; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Object::Pad; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # ABSTRACT: WebService::Netlify needs a propper abstract | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | class WebService::Netlify :does(WebService::Netlify::Roles::OpenAPI); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use File::stat; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Mojo::File 'path'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | method get_user { | ||||||||||||||||||||||||||
|
Subroutine
get_user: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 1 | return $self->api_call('getCurrentUser', {@_}); | |||||||||||||||||||||||||||
| 16 | 2 | } | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | method list_sites { | ||||||||||||||||||||||||||
|
Subroutine
list_sites: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 1 | return $self->api_call('listSites', {@_}); | |||||||||||||||||||||||||||
| 20 | 2 | } | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | method deploy_site($site_id, $file, %args) { | ||||||||||||||||||||||||||
|
Subroutine
deploy_site: called CC=8 SCAR=21.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | my %files; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | if (ref $file eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | %files = %$file; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | else { | ||||||||||||||||||||||||||||
| 30 | 1 | ▶ | open my $fh, '<', $file or die "Cannot open $file $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 1 | chomp; | |||||||||||||||||||||||||||
| 33 | 1 | ▶ | next if /^\s*$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 1 | my ($sha, $path, @rest) = split(/\s+/, $_); | |||||||||||||||||||||||||||
| 35 | 1 | ▶ | next unless $sha && $path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$sha and $path
MC/DC0%0/2
$sha and $path
$sha
$path
Truth table33%1/3
A and B
A= $shaB= $path
| |||||||||||||||||||||||||||||
| 36 | 1 | $files{$path} = $sha; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | 1 | close $fh; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 1 | my %body = ( files => \%files ); | |||||||||||||||||||||||||||
| 42 | 1 | ▶ | $body{draft} = delete $args{draft} if exists $args{draft}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | return $self->api_call('createSiteDeploy', | |||||||||||||||||||||||||||
| 45 | { %args, site_id => $site_id, }, json => \%body,); | ||||||||||||||||||||||||||||
| 46 | 2 | } | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 2 | ▶ | method deploy_file($deploy_id, $file, $path = undef) { | ||||||||||||||||||||||||||
|
Subroutine
deploy_file: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 49 | 2 | ▶ | my $st = stat($file) or die "Cannot stat $file: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | ▶ | $path //= $file; | ||||||||||||||||||||||||||
|
Condition66%2/3
$path //= $file
MC/DC0%0/2
$path //= $file
$path
$file
Truth table66%2/3
A //= B
A= $pathB= $file
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 2 | return $self->api_call( | |||||||||||||||||||||||||||
| 54 | 'uploadDeployFile', | ||||||||||||||||||||||||||||
| 55 | { | ||||||||||||||||||||||||||||
| 56 | deploy_id => $deploy_id, | ||||||||||||||||||||||||||||
| 57 | path => $path, | ||||||||||||||||||||||||||||
| 58 | size => $st->size, | ||||||||||||||||||||||||||||
| 59 | }, | ||||||||||||||||||||||||||||
| 60 | deploy_file => $path, | ||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||
| 62 | 2 | } | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | method cancel_deploy($deploy_id) { | ||||||||||||||||||||||||||
|
Subroutine
cancel_deploy: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 0 | return $self->api_call( | |||||||||||||||||||||||||||
| 66 | 'cancelSiteDeploy', | ||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||
| 68 | deploy_id => $deploy_id, | ||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||
| 71 | 2 | } | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 2 | 1; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =pod | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =head1 NAME | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | WebService::Netlify - WebService::Netlify needs a propper abstract | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =head1 VERSION | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | version 0.001 | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Wesley Schwengle <waterkip@cpan.org> | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | This software is Copyright (c) 2025 by Wesley Schwengle. | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | The (three-clause) BSD License | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | =cut | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | __DATA__ | ||||||||||||||||||||||||||||