lib/Net/API/CPAN/DownloadUrl.pm

filter: Statementstmt 97.6% 41 / 42 Branchbran 50.0% 8 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 93.7% 15 / 16 Podpod 100% 9 / 9 totaltotal 87.9% 73 / 83 CC 9 SCAR 15.3
CC
9
Cov
84%
init
10.5
object
2.0
BEGIN
1.0
CRAP 4.6
« lib/Net/API/CPAN/Rating.pm ↑ Summary lib/Net/API/CPAN/Favorite.pm »
1 ##----------------------------------------------------------------------------
2 ## Meta CPAN API - ~/lib/Net/API/CPAN/DownloadUrl.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2023 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2023/07/25
7 ## Modified 2023/09/26
8 ## All rights reserved
9 ##
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 # This module file has been automatically generated. Any change made here will be lost.
15 # Edit the script in ./build/build_modules.pl instead
16 package Net::API::CPAN::DownloadUrl;
17 BEGIN
18 {
19 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶ use parent qw( Net::API::CPAN::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶ our $VERSION = 'v0.1.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 };
25  
26 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 sub init
30 {
31 1 ▶ my $self = shift( @_ );
Subroutine init: called CC=9 SCAR=23.5
Pod documented
32 1 ▶ $self->{checksum_md5} = undef unless( CORE::exists( $self->{checksum_md5} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"checksum_md5"} 1 0 1
33 1 ▶ $self->{checksum_sha256} = undef unless( CORE::exists( $self->{checksum_sha256} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"checksum_sha256"} 1 0 1
34 1 ▶ $self->{date} = undef unless( CORE::exists( $self->{date} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"date"} 1 0 1
35 1 ▶ $self->{download_url} = undef unless( CORE::exists( $self->{download_url} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"download_url"} 1 0 1
36 1 $self->{object} = 'download_url';
37 1 ▶ $self->{release} = undef unless( CORE::exists( $self->{release} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"release"} 1 0 1
38 1 ▶ $self->{status} = undef unless( CORE::exists( $self->{status} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"status"} 1 0 1
39 1 ▶ $self->{version} = '' unless( CORE::exists( $self->{version} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"version"} 1 0 1
40 1 $self->{_init_strict_use_sub} = 1;
41 1 $self->{_exception_class} = 'Net::API::CPAN::Exception';
42 1 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 1 1
43 1 $self->{fields} = [qw(
44 checksum_md5 checksum_sha256 date download_url release status version
45 )];
46 1 return( $self );
47 }
48  
49 2 ▶sub checksum_md5 { return( shift->_set_get_scalar_as_object( 'checksum_md5', @_ ) ); }
Subroutine checksum_md5: called CC=1 SCAR=0.0
Pod documented
50  
51 2 ▶sub checksum_sha256 { return( shift->_set_get_scalar_as_object( 'checksum_sha256', @_ ) ); }
Subroutine checksum_sha256: called CC=1 SCAR=0.0
Pod documented
52  
53 2 ▶sub date { return( shift->_set_get_datetime( 'date', @_ ) ); }
Subroutine date: called CC=1 SCAR=0.0
Pod documented
54  
55 2 ▶sub download_url { return( shift->_set_get_uri( 'download_url', @_ ) ); }
Subroutine download_url: called CC=1 SCAR=0.0
Pod documented
56  
57 0 ▶sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
Subroutine object: not called CC=1 SCAR=6.9
Pod documented
58  
59 2 ▶sub release { return( shift->_set_get_scalar_as_object( 'release', @_ ) ); }
Subroutine release: called CC=1 SCAR=0.0
Pod documented
60  
61 2 ▶sub status { return( shift->_set_get_scalar_as_object( 'status', @_ ) ); }
Subroutine status: called CC=1 SCAR=0.0
Pod documented
62  
63 2 ▶sub version { return( shift->_set_get_version( { class => "Changes::Version", field => "version" }, @_ ) ); }
Subroutine version: called CC=1 SCAR=0.0
Pod documented
64  
65 2 1;
66 # NOTE: POD
67 __END__
68  
69 =encoding utf-8
70  
71 =head1 NAME
72  
73 Net::API::CPAN::DownloadUrl - Meta CPAN API DownloadUrl Class
74  
75 =head1 SYNOPSIS
76  
77 use Net::API::CPAN::DownloadUrl;
78 my $obj = Net::API::CPAN::DownloadUrl->new( {
79 checksum_md5 => "71682907d95a4b0a4b74da8c16e88d2d",
80 checksum_sha256 => "27d4da9e772bc1922618b36fdefa768344d92c3d65a5e3cc427218cfc8d7491d",
81 date => "2023-07-29T05:10:12",
82 download_url => "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO/Folklore-Japan-v1.2.3.tar.gz",
83 release => "Folklore-Japan-v1.2.3",
84 status => "latest",
85 version => "v1.2.3",
86 } ) || die( Net::API::CPAN::DownloadUrl->error );
87
88 my $string = $obj->checksum_md5;
89 my $string = $obj->checksum_sha256;
90 my $date = $obj->date;
91 my $uri = $obj->download_url;
92 my $str = $obj->object;
93 my $string = $obj->release;
94 my $string = $obj->status;
95 my $vers = $obj->version;
96  
97 =head1 VERSION
98  
99 v0.1.0
100  
101 =head1 DESCRIPTION
102  
103 This class serves to retrieve and manipulate download_urls.
104  
105 It inherits from L<Net::API::CPAN::Generic>
106  
107 =head1 CONSTRUCTOR
108  
109 =head2 new
110  
111 Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::DownloadUrl> object.
112  
113 The parameters that can be provided bear the same name and supports the same values as the methods below.
114  
115 =head1 METHODS
116  
117 =head2 checksum_md5
118  
119 $obj->checksum_md5( "71682907d95a4b0a4b74da8c16e88d2d" );
120 my $string = $obj->checksum_md5;
121  
122 Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
123  
124 =head2 checksum_sha256
125  
126 $obj->checksum_sha256( "27d4da9e772bc1922618b36fdefa768344d92c3d65a5e3cc427218cfc8d7491d" );
127 my $string = $obj->checksum_sha256;
128  
129 Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
130  
131 =head2 date
132  
133 $obj->date( "2023-07-29T05:10:12" );
134 my $datetime_obj = $obj->date;
135  
136 Sets or gets a datetime value, and returns a L<DateTime object|DateTime> that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or C<undef> if no value is set.
137  
138 =head2 download_url
139  
140 $obj->download_url( "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO/Folklore-Japan-v1.2.3.tar.gz" );
141 my $uri = $obj->download_url;
142  
143 Sets or gets an L<URI>, and returns an L<URI object|URI> or C<undef> if no value is set.
144  
145 =head2 object
146  
147 Returns the object type for this class, which is C<download_url>
148  
149 =head2 release
150  
151 $obj->release( "Folklore-Japan-v1.2.3" );
152 my $string = $obj->release;
153  
154 Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
155  
156 =head2 status
157  
158 $obj->status( "latest" );
159 my $string = $obj->status;
160  
161 Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
162  
163 =head2 version
164  
165 $obj->version( "v1.2.3" );
166 my $version = $obj->version;
167  
168 Sets or gets a version value and returns a version object using L<Changes::Version>.
169  
170 =head1 API SAMPLE
171  
172 {
173 "checksum_md5" : "71682907d95a4b0a4b74da8c16e88d2d",
174 "checksum_sha256" : "27d4da9e772bc1922618b36fdefa768344d92c3d65a5e3cc427218cfc8d7491d",
175 "date" : "2023-07-29T05:10:12",
176 "download_url" : "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO/Folklore-Japan-v1.2.3.tar.gz",
177 "release" : "Folklore-Japan-v1.2.3",
178 "status" : "latest",
179 "version" : "v1.2.3",
180 }
181  
182 =head1 AUTHOR
183  
184 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
185  
186 =head1 SEE ALSO
187  
188 L<Net::API::CPAN>, L<Net::API::CPAN::Activity>, L<Net::API::CPAN::Author>, L<Net::API::CPAN::Changes>, L<Net::API::CPAN::Changes::Release>, L<Net::API::CPAN::Contributor>, L<Net::API::CPAN::Cover>, L<Net::API::CPAN::Diff>, L<Net::API::CPAN::Distribution>, L<Net::API::CPAN::DownloadUrl>, L<Net::API::CPAN::Favorite>, L<Net::API::CPAN::File>, L<Net::API::CPAN::Module>, L<Net::API::CPAN::Package>, L<Net::API::CPAN::Permission>, L<Net::API::CPAN::Rating>, L<Net::API::CPAN::Release>
189  
190 L<MetaCPAN::API>, L<MetaCPAN::Client>
191  
192 L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md>
193  
194 =head1 COPYRIGHT & LICENSE
195  
196 Copyright(c) 2023 DEGUEST Pte. Ltd.
197  
198 All rights reserved
199  
200 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
201  
202 =cut
203  
« lib/Net/API/CPAN/Rating.pm ↑ Summary lib/Net/API/CPAN/Favorite.pm »