#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2010 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package BookPub::Tracker::Command::DownloadRoyaltyReport::SagePub;
use strict;
use warnings;

# The only difference here is that we are returning an already generated zip file.

sub getResponse {
    my ( $self, $report ) = @_;

    my $filePath = $report->zipFilePath();
    if ( !-f $filePath ) {
        $report->create();
    }

    open( my $fh, $report->zipFilePath() );
    my $response = RSApache::Response::Download->new( $fh, 'application/octet-stream', $report->zipFileName() );

    return $response;
}

1;
