File Coverage

lib/App/MtAws/QueueJob/DownloadInventory.pm
Criterion Covered Total %
statement 24 24 100.0
branch 2 2 100.0
condition 3 6 50.0
subroutine 8 8 100.0
pod 0 2 0.0
total 37 42 88.1


line stmt bran cond sub pod time code
1             # mt-aws-glacier - Amazon Glacier sync client
2             # Copyright (C) 2012-2014 Victor Efimov
3             # http://mt-aws.com (also http://vs-dev.com) vs@vs-dev.com
4             # License: GPLv3
5             #
6             # This file is part of "mt-aws-glacier"
7             #
8             # mt-aws-glacier is free software: you can redistribute it and/or modify
9             # it under the terms of the GNU General Public License as published by
10             # the Free Software Foundation, either version 3 of the License, or
11             # (at your option) any later version.
12             #
13             # mt-aws-glacier is distributed in the hope that it will be useful,
14             # but WITHOUT ANY WARRANTY; without even the implied warranty of
15             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16             # GNU General Public License for more details.
17             #
18             # You should have received a copy of the GNU General Public License
19             # along with this program. If not, see <http://www.gnu.org/licenses/>.
20              
21             package App::MtAws::QueueJob::DownloadInventory;
22              
23             our $VERSION = '1.114_2';
24              
25 4     4   647 use strict;
  4         6  
  4         97  
26 4     4   20 use warnings;
  4         5  
  4         101  
27 4     4   14 use Carp;
  4         5  
  4         169  
28              
29 4     4   28 use App::MtAws::QueueJobResult;
  4         4  
  4         265  
30 4     4   64 use base 'App::MtAws::QueueJob';
  4         5  
  4         1717  
31              
32             sub init
33             {
34 26     26 0 43 my ($self) = @_;
35 26 100       226 $self->{job_id} || confess;
36 25         75 $self->enter('download');
37             }
38              
39             sub on_download
40             {
41 24     24 0 39 my ($self) = @_;
42             return state "wait", task "inventory_download_job", { job_id => $self->{job_id} } => sub {
43 24     24   46 my ($args, $attachment) = @_;
44 24   66     255 $self->{inventory_raw_ref} = $attachment || confess "no attachment"; # we don't expect undef/FALSE here. only scalar ref
45 23   33     92 $self->{inventory_type} = $args->{inventory_type} || confess "no inventory type";
46 23         79 state("done")
47             }
48 24         69 }
49              
50             1;