From 57b73c1b146dd794ece28a5bb275e15094965ffb Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Thu, 17 Mar 2022 17:32:56 +0100 Subject: [PATCH] Adding documentation for all models and a test to check all documentation. --- Build.PL | 27 +++---- MYMETA.json | 3 +- lib/Peace.pm | 8 ++ lib/Peace/Model/Application.pm | 137 ++++++++++++++++++++++++++++++++- lib/Peace/Model/Customer.pm | 8 +- lib/Peace/Model/Developer.pm | 127 ++++++++++++++++++++++++++++++ t/00009-pod-coverage.t | 16 ++++ 7 files changed, 307 insertions(+), 19 deletions(-) create mode 100644 t/00009-pod-coverage.t diff --git a/Build.PL b/Build.PL index 141e2ec..cc0df1e 100644 --- a/Build.PL +++ b/Build.PL @@ -3,24 +3,25 @@ use Module::Build; my $home = $ENV{HOME}; my $build = Module::Build->new( - module_name => 'Peace', - license => 'AGPLv3', - dist_author => 'Sergio Iglesias ', + module_name => 'Peace', + license => 'AGPLv3', + dist_author => 'Sergio Iglesias ', dist_abstract => 'Peace application shop.', - requires => { - 'Mojolicious' => 0, - 'DBI' => 0, - 'DBD::Pg' => 0, - 'DBD::Mock' => 0, - 'DateTime' => 0, + requires => { + 'Mojolicious' => 0, + 'DBI' => 0, + 'DBD::Pg' => 0, + 'DBD::Mock' => 0, + 'DateTime' => 0, 'DateTime::Format::Pg' => 0, - 'Test::Most' => 0, - 'Test::MockObject' => 0, - 'Test::MockModule' => 0, + 'Test::Most' => 0, + 'Test::MockObject' => 0, + 'Test::MockModule' => 0, + 'Test::Pod::Coverage' => 0, }, install_path => { 'templates' => "$HOME/.local/share/peace/template", - 'public' => "$HOME/.local/share/peace/public", + 'public' => "$HOME/.local/share/peace/public", } ); $build->create_build_script; diff --git a/MYMETA.json b/MYMETA.json index bcdc871..4c40b0c 100644 --- a/MYMETA.json +++ b/MYMETA.json @@ -24,7 +24,8 @@ "Mojolicious" : "0", "Test::MockModule" : "0", "Test::MockObject" : "0", - "Test::Most" : "0" + "Test::Most" : "0", + "Test::Pod::Coverage" : "0" } } }, diff --git a/lib/Peace.pm b/lib/Peace.pm index 70c5cbd..e0e517e 100644 --- a/lib/Peace.pm +++ b/lib/Peace.pm @@ -38,4 +38,12 @@ Peace - Onlie GNU/Linux flatpak apps store. Peace is the server backend for flatstore a shop to be able to sell or buy flatpak applications. +=head1 FUNCTIONS + +Peace implements the following functions: + +=head2 startup + +For internal usage from Mojolicious. + =cut diff --git a/lib/Peace/Model/Application.pm b/lib/Peace/Model/Application.pm index 7a5ff11..3050a46 100644 --- a/lib/Peace/Model/Application.pm +++ b/lib/Peace/Model/Application.pm @@ -178,7 +178,7 @@ use DateTime; } { - my $validator = + my $validator = validation_for( params => [ { type => Str, optional => 1 } ] ); sub git_repo { @@ -196,3 +196,138 @@ sub _dbh { return $self->{dbh}; } 1; + +=encoding utf8 + +=head1 NAME + +Peace::Model::Application - The application object representation. + +=head1 SYNOPSIS + + my $application = Peace::Model::Application->new( + name => $name, + description => $description, + url => $url, + developer => $developer, + price => $price, + git_repo => $git_repo, + flatpak_builder_file => $flatpak_builder_file, + verified => $verified, + ); + +=head1 DESCRIPTION + +Describes a application from Peace for sale. + +=head1 INSTANCE METHODS + +Peace::Model::Application implements the following instance methods: + +=head2 new + + my $application = Peace::Model::Application->new( + uuid => $uuid, # optional + date_creation => $date_creation, # optional + name => $name, + description => $description, + url => $url, + developer => $developer, # required or developer_uuid should be passed. + developer_uuid => $developer_uuid, # required or developer should be passed. + dbh => $dbh, # needed if developer_uuid is passed. + price => $price, + git_repo => $git_repo, + flatpak_builder_file => $flatpak_builder_file, + verified => $verified, + ); + +=head1 METHODS + +Peace::Model::Application implements the following methods: + +=head2 uuid + + my $uuid = $application->uuid; + + $application->uuid($uuid); + +Allows to retrieve and set the application's uuid. + +=head2 date_creation + + my $date_creation = $application->date_creation; + + $application->date_creation($date_creation); + +Allows to retrieve and set the application's date_creation. + +=head2 name + + my $name = $application->name; + + $application->name($name); + +Allows to retrieve and set the application's name. + +=head2 description + + my $description = $application->description; + + $application->description($description); + +Allows to retrieve and set the application's description. + +=head2 url + + my $url = $application->url; + + $application->url($url); + +Allows to retrieve and set the application's url. + +=head2 developer + + my $developer = $application->developer; + + $application->developer($developer); + +Allows to retrieve and set the application's developer which +is a L. + +=head2 price + + my $price = $application->price; + + $application->price($price); + +Allows to retrieve and set the application's price. + +=head2 git_repo + + my $git_repo = $application->git_repo; + + $application->git_repo($git_repo); + +Allows to retrieve and set the application's git_repo. + +=head2 flatpak_builder_file + + my $flatpak_builder_file = $application->flatpak_builder_file; + + $application->flatpak_builder_file($flatpak_builder_file); + +Allows to retrieve and set the application's flatpak_builder_file. + +=head2 verified + + my $verified = $application->verified; + + $application->verified($verified); + +Allows to retrieve and set the application's verified status. + +=head1 SEE ALSO + +L, L + +=cut diff --git a/lib/Peace/Model/Customer.pm b/lib/Peace/Model/Customer.pm index 880bc05..331d913 100644 --- a/lib/Peace/Model/Customer.pm +++ b/lib/Peace/Model/Customer.pm @@ -88,7 +88,7 @@ use DateTime; =head1 NAME -Peace::Model::Customer - The customer object representation +Peace::Model::Customer - The customer object representation. =head1 SYNOPSIS @@ -125,7 +125,7 @@ Peace::Model::Customer implements the following methods: $customer->uuid($uuid); -Allows to retrive and set the customer uuid. +Allows to retrieve and set the customer uuid. =head2 date_creation @@ -133,7 +133,7 @@ Allows to retrive and set the customer uuid. $customer->date_creation($date_creation); -Allows to retrive and set the customer date_creation. +Allows to retrieve and set the customer date_creation. =head2 secret_bcrypt @@ -141,7 +141,7 @@ Allows to retrive and set the customer date_creation. $customer->secret_bcrypt($secret_bcrypt); -Allows to retrive and set the customer secret_bcrypt. +Allows to retrieve and set the customer secret_bcrypt. =head2 stripe_id diff --git a/lib/Peace/Model/Developer.pm b/lib/Peace/Model/Developer.pm index fdbd1df..440beeb 100644 --- a/lib/Peace/Model/Developer.pm +++ b/lib/Peace/Model/Developer.pm @@ -181,3 +181,130 @@ sub _dbh { return $self->{dbh}; } 1; +=encoding utf8 + +=head1 NAME + +Peace::Model::Developer - The developer object representation. + +=head1 SYNOPSIS + + my $developer = Peace::Model::Developer->new( + secret_bcrypt => $secret_bcrypt, + name => $name, + surname => $surname, + email => $email, + country => $country, + verified => $verified, + ); + +=head1 DESCRIPTION + +Describes a developer capable of submit Applications to Peace +and get money. + +=head1 INSTANCE METHODS + +Peace::Model::Developer implements the following instance methods: + +=head2 new + + my $developer = Peace::Model::Developer->new( + uuid => $uuid, # optional + date_creation => $date_creation, # optional + secret_bcrypt => $secret_bcrypt, + name => $name, + surname => $surname, + email => $email, + stripe_id => $stripe_id, # optional + country => $country, + verified => $verified, + dbh => $dbh, # optional, allows to retrieve applications + ); + +=head1 METHODS + +Peace::Model::Developer implements the following methods: + +=head2 applications + + my $applications = $developer->applications; + +Allows to retrieve the developer's applications which is a arrayref of +L. + +=head2 uuid + + my $uuid = $developer->uuid; + + $developer->uuid($uuid); + +Allows to retrieve and set the developer uuid. + +=head2 date_creation + + my $date_creation = $developer->date_creation; + + $developer->date_creation($date_creation); + +Allows to retrieve and set the developer date_creation. + +=head2 secret_bcrypt + + my $secret_bcrypt = $developer->secret_bcrypt; + + $developer->secret_bcrypt($secret_bcrypt); + +Allows to retrieve and set the developer secret_bcrypt. + +=head2 name + + my $name = $developer->name; + + $developer->name($name); + +Allows to retrieve and set the developer name. + +=head2 surname + + my $surname = $developer->surname; + + $developer->surname($surname); + +=head2 email + + my $email = $developer->email; + + $developer->email($email); + +Allows to retrieve and set the developer email. + +=head2 stripe_id + + my $stripe_id = $developer->stripe_id; + + $developer->stripe_id($stripe_id); + +Allows to retrieve and set the developer stripe_id. + +=head2 country + + my $country = $developer->country; + + $developer->country($country); + +Allows to retrieve and set the developer country. + +=head2 verified + + my $verified = $developer->verified + + $developer->verified($verified); + +Allows to retrieve and set the developer verified. + +=head1 SEE ALSO + +L, L + +=cut diff --git a/t/00009-pod-coverage.t b/t/00009-pod-coverage.t new file mode 100644 index 0000000..1803fa6 --- /dev/null +++ b/t/00009-pod-coverage.t @@ -0,0 +1,16 @@ +#!/usr/bin/env perl + +use v5.30.0; + +use strict; +use warnings; + +use Test::Most tests => 1; +use Test::Pod::Coverage; + +{ + my @modules = Test::Pod::Coverage::all_modules; + for my $module (@modules) { + pod_coverage_ok($module); + } +}