Skip to content

Commit

Permalink
basic file endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bricas committed Nov 14, 2011
1 parent 80dfdb2 commit f514e5d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/SixteenColors/API/Controller/Pack.pm
Expand Up @@ -30,6 +30,19 @@ sub view : Chained('instance') PathPart('') Args(0) {
$self->status_ok( $c, entity => $c->stash->{ pack } );
}

sub file : Chained('instance') PathPart('') Args(1) {
my( $self, $c, $arg ) = @_;

my $file = $c->stash->{ pack }->files( { filename => $arg } )->first;

if( !$file ) {
$self->status_not_found( $c, message => 'Invalid File' );
$c->detach;
}

$self->status_ok( $c, entity => $file );
}

1;

__END__
Expand Down

0 comments on commit f514e5d

Please sign in to comment.