File Coverage

lib/Net/API/CPAN/Favorite.pm
Criterion Covered Total %
statement 38 39 97.4
branch 7 14 50.0
condition n/a
subroutine 14 15 93.3
pod 8 8 100.0
total 67 76 88.1


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Meta CPAN API - ~/lib/Net/API/CPAN/Favorite.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::Favorite;
17             BEGIN
18             {
19 2     2   223881 use strict;
  2         11  
  2         73  
20 2     2   11 use warnings;
  2         3  
  2         74  
21 2     2   13 use parent qw( Net::API::CPAN::Generic );
  2         3  
  2         16  
22 2     2   117 use vars qw( $VERSION );
  2         4  
  2         91  
23 2     2   39 our $VERSION = 'v0.1.0';
24             };
25              
26 2     2   9 use strict;
  2         5  
  2         39  
27 2     2   10 use warnings;
  2         4  
  2         660  
28              
29             sub init
30             {
31 1     1 1 9189 my $self = shift( @_ );
32 1 50       68 $self->{author} = undef unless( CORE::exists( $self->{author} ) );
33 1 50       4 $self->{date} = undef unless( CORE::exists( $self->{date} ) );
34 1 50       4 $self->{distribution} = undef unless( CORE::exists( $self->{distribution} ) );
35 1 50       4 $self->{id} = undef unless( CORE::exists( $self->{id} ) );
36 1         2 $self->{object} = 'favorite';
37 1 50       4 $self->{release} = undef unless( CORE::exists( $self->{release} ) );
38 1 50       3 $self->{user} = undef unless( CORE::exists( $self->{user} ) );
39 1         3 $self->{_init_strict_use_sub} = 1;
40 1         2 $self->{_exception_class} = 'Net::API::CPAN::Exception';
41 1 50       6 $self->SUPER::init( @_ ) || return( $self->pass_error );
42 1         7 $self->{fields} = [qw( author date distribution id release user )];
43 1         3 return( $self );
44             }
45              
46 2     2 1 5366 sub author { return( shift->_set_get_scalar_as_object( 'author', @_ ) ); }
47              
48 2     2 1 1673 sub date { return( shift->_set_get_datetime( 'date', @_ ) ); }
49              
50 2     2 1 3796 sub distribution { return( shift->_set_get_scalar_as_object( 'distribution', @_ ) ); }
51              
52 2     2 1 2644226 sub id { return( shift->_set_get_scalar_as_object( 'id', @_ ) ); }
53              
54 0     0 1 0 sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
55              
56 2     2 1 2425 sub release { return( shift->_set_get_scalar_as_object( 'release', @_ ) ); }
57              
58 2     2 1 52573 sub user { return( shift->_set_get_scalar_as_object( 'user', @_ ) ); }
59              
60             1;
61             # NOTE: POD
62             __END__
63              
64             =encoding utf-8
65              
66             =head1 NAME
67              
68             Net::API::CPAN::Favorite - Meta CPAN API Favorite Class
69              
70             =head1 SYNOPSIS
71              
72             use Net::API::CPAN::Favorite;
73             my $obj = Net::API::CPAN::Favorite->new( {
74             author => "MOMOTTARO",
75             date => "2023-07-29T05:12:10",
76             distribution => "Folklore-Japan",
77             id => "Go34To56Ok78aY90ama_I",
78             release => "Folklore-Japan-v1.2.3",
79             user => "JA01Pa34nIs56Co89ol",
80             } ) || die( Net::API::CPAN::Favorite->error );
81            
82             my $string = $obj->author;
83             my $date = $obj->date;
84             my $string = $obj->distribution;
85             my $string = $obj->id;
86             my $str = $obj->object;
87             my $string = $obj->release;
88             my $string = $obj->user;
89              
90             =head1 VERSION
91              
92             v0.1.0
93              
94             =head1 DESCRIPTION
95              
96             This class serves to retrieve and manipulate favorites.
97              
98             It inherits from L<Net::API::CPAN::Generic>
99              
100             =head1 CONSTRUCTOR
101              
102             =head2 new
103              
104             Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::Favorite> object.
105              
106             The parameters that can be provided bear the same name and supports the same values as the methods below.
107              
108             =head1 METHODS
109              
110             =head2 author
111              
112             $obj->author( "MOMOTTARO" );
113             my $string = $obj->author;
114              
115             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
116              
117             =head2 date
118              
119             $obj->date( "2023-07-29T05:12:10" );
120             my $datetime_obj = $obj->date;
121              
122             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.
123              
124             =head2 distribution
125              
126             $obj->distribution( "Folklore-Japan" );
127             my $string = $obj->distribution;
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 id
132              
133             $obj->id( "Go34To56Ok78aY90ama_I" );
134             my $string = $obj->id;
135              
136             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
137              
138             =head2 object
139              
140             Returns the object type for this class, which is C<favorite>
141              
142             =head2 release
143              
144             $obj->release( "Folklore-Japan-v1.2.3" );
145             my $string = $obj->release;
146              
147             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
148              
149             =head2 user
150              
151             $obj->user( "JA01Pa34nIs56Co89ol" );
152             my $string = $obj->user;
153              
154             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
155              
156             =head1 API SAMPLE
157              
158             {
159             "date" : "2023-07-29T05:12:10",
160             "release" : "Folklore-Japan-v1.2.3",
161             "distribution" : "Folklore-Japan",
162             "author" : "MOMOTTARO",
163             "user" : "JA01Pa34nIs56Co89ol",
164             "id" : "Go34To56Ok78aY90ama_I"
165             }
166              
167             =head1 AUTHOR
168              
169             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
170              
171             =head1 SEE ALSO
172              
173             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>
174              
175             L<MetaCPAN::API>, L<MetaCPAN::Client>
176              
177             L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md>
178              
179             =head1 COPYRIGHT & LICENSE
180              
181             Copyright(c) 2023 DEGUEST Pte. Ltd.
182              
183             All rights reserved
184              
185             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
186              
187             =cut
188