File Coverage

blib/lib/Articulate/Routes/TransparentPreviews.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Articulate::Routes::TransparentPreviews;
2 4     4   2145 use strict;
  4         5  
  4         137  
3 4     4   20 use warnings;
  4         6  
  4         99  
4              
5 4     4   17 use Moo;
  4         12  
  4         20  
6             with 'Articulate::Role::Routes';
7 4     4   4910 use Articulate::Syntax::Routes;
  4         6  
  4         28  
8 4     4   3036 use Articulate::Service;
  4         7  
  4         20  
9              
10             post '/zone/:zone_id/preview' => sub {
11             my ($self, $request) = @_;
12             my $zone_id = $request->params->{'zone_id'};
13             my $article_id = $request->params->{'article_id'};
14             return $self->process_request( error => {
15             simple_message => 'Parameter article_id is required'
16             } ) unless defined $article_id and $article_id ne '';
17             my $content = $request->params->{'content'};
18             $self->process_request(
19             preview => {
20             location =>"zone/$zone_id/article/$article_id",
21             content => $content,
22             }
23             );
24             };
25              
26             1;