-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian Duggan
committed
Mar 28, 2014
1 parent
4396dce
commit 91eac94
Showing
6 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
=head1 NAME | ||
Tuba::DocManager -- manage documentation for routes. | ||
=cut | ||
|
||
package Tuba::DocManager; | ||
use Mojo::Base qw/-base/; | ||
use Tuba::RouteDoc; | ||
use Tuba::RouteParam; | ||
use Mojo::ByteStream qw/b/; | ||
|
||
our %RouteDoc = ( | ||
uuid => { | ||
brief => "Generate a version 4 UUIDs", | ||
description => b(q[<p>Generate version 4 Universally Unique Identifiers. The algorithm used for this | ||
is described <a target="_blank" href="https://en.wikipedia.org/wiki/UUID#Version_4_.28random.29">here</a>. | ||
</p>]), | ||
params => [ | ||
{ | ||
name => "count", | ||
type => "integer", | ||
description => "Number of UUIDs to generate (max 1000)" | ||
} | ||
] | ||
}, | ||
); | ||
|
||
sub find_doc { | ||
my $c = shift; | ||
my $route_name = shift; | ||
my $entry = $RouteDoc{$route_name} or return; | ||
return Tuba::RouteDoc->new( | ||
name => $route_name, | ||
brief => $entry->{brief}, | ||
description => $entry->{description}, | ||
params => [ map Tuba::RouteParam->new( %$_ ), @{ $entry->{params} } ] | ||
); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=head1 NAME | ||
Tuba::RouteDoc -- documentation for a route. | ||
=cut | ||
|
||
package Tuba::RouteDoc; | ||
use Mojo::Base qw/-base/; | ||
|
||
has 'name'; | ||
has 'description'; | ||
has 'params'; | ||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=head1 NAME | ||
Tuba::RouteParam -- a single parameter for a route. | ||
=cut | ||
|
||
package Tuba::RouteParam; | ||
use Mojo::Base qw/-base/; | ||
|
||
has 'name'; | ||
has 'type'; | ||
has 'description'; | ||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters