Net::FreshBooks::API::Role::SendBy - Send by email and snail mail roles


Net-FreshBooks-API documentation Contained in the Net-FreshBooks-API distribution.

Index


Code Index:

NAME

Top

Net::FreshBooks::API::Role::SendBy - Send by email and snail mail roles

VERSION

Top

version 0.21

SYNOPSIS

Top

Roles for sending by email and snail mail. Used for both Estimates and Invoices. Please refer to these modules for specific examples of how to use these methods.

send_by_email

send_by_snail_mail

AUTHORS

Top

COPYRIGHT AND LICENSE

Top


Net-FreshBooks-API documentation Contained in the Net-FreshBooks-API distribution.

use strict;
use warnings;

package Net::FreshBooks::API::Role::SendBy;
BEGIN {
  $Net::FreshBooks::API::Role::SendBy::VERSION = '0.21';
}

use Moose::Role;
use Data::Dump qw( dump );

sub send_by_email {
    my $self = shift;
    return $self->_send_using( 'sendByEmail' );
}

sub send_by_snail_mail {
    my $self = shift;
    return $self->_send_using( 'sendBySnailMail' );
}

sub _send_using {
    my $self = shift;
    my $how  = shift;

    my $method   = $self->method_string( $how );
    my $id_field = $self->id_field;

    my $res = $self->send_request(
        {   _method   => $method,
            $id_field => $self->$id_field,
        }
    );

    # refetch the estimate so that the flags are updated.
    $self->get( { $id_field => $self->$id_field } );

    return 1;
}

1;

# ABSTRACT: Send by email and snail mail roles


__END__