blib/lib/Net/API/CPAN/DownloadUrl.pm untested

filter: Statementstmt 0.0% 0 / 44 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 86 CC 8 SCAR 32.7
CC
8
Cov
0%
init
72.0
BEGIN
2.0
checksum_md5
2.0
CRAP 26.3
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 use strict;
20 use warnings;
21 use parent qw( Net::API::CPAN::Generic );
22 use vars qw( $VERSION );
23 our $VERSION = 'v0.1.0';
24 };
25  
26 use strict;
27 use warnings;
28  
29 sub init
30 {
31 my $self = shift( @_ );
32 $self->{checksum_md5} = undef unless( CORE::exists( $self->{checksum_md5} ) );
33 $self->{checksum_sha256} = undef unless( CORE::exists( $self->{checksum_sha256} ) );
34 $self->{date} = undef unless( CORE::exists( $self->{date} ) );
35 $self->{download_url} = undef unless( CORE::exists( $self->{download_url} ) );
36 $self->{object} = 'download_url';
37 $self->{release} = undef unless( CORE::exists( $self->{release} ) );
38 $self->{status} = undef unless( CORE::exists( $self->{status} ) );
39 $self->{version} = '' unless( CORE::exists( $self->{version} ) );
40 $self->{_init_strict_use_sub} = 1;
41 $self->{_exception_class} = 'Net::API::CPAN::Exception';
42 $self->SUPER::init( @_ ) || return( $self->pass_error );
43 $self->{fields} = [qw(
44 checksum_md5 checksum_sha256 date download_url release status version
45 )];
46 return( $self );
47 }
48  
49 sub checksum_md5 { return( shift->_set_get_scalar_as_object( 'checksum_md5', @_ ) ); }
50  
51 sub checksum_sha256 { return( shift->_set_get_scalar_as_object( 'checksum_sha256', @_ ) ); }
52  
53 sub date { return( shift->_set_get_datetime( 'date', @_ ) ); }
54  
55 sub download_url { return( shift->_set_get_uri( 'download_url', @_ ) ); }
56  
57 sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
58  
59 sub release { return( shift->_set_get_scalar_as_object( 'release', @_ ) ); }
60  
61 sub status { return( shift->_set_get_scalar_as_object( 'status', @_ ) ); }
62  
63 sub version { return( shift->_set_get_version( { class => "Changes::Version", field => "version" }, @_ ) ); }
64  
65 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