Business-UPS-Tracking
view release on metacpan or search on metacpan
lib/Business/UPS/Tracking/Role/Base.pm view on Meta::CPAN
# ============================================================================
package Business::UPS::Tracking::Role::Base;
# ============================================================================
use utf8;
use 5.0100;
use Moose::Role;
no if $] >= 5.017004, warnings => qw(experimental::smartmatch);
use Try::Tiny;
use Path::Class::File;
=encoding utf8
=head1 NAME
Business::UPS::Tracking::Role::Base - Helper role
=head1 DESCRIPTION
This role provides accessors for the UPS webservice credentials.
The credentials can be provided when constructing a new object, or optionally
stored in a configuration file.
=head1 ACCESSORS
=head2 AccessLicenseNumber
UPS tracking service access license number
=head2 UserId
UPS account username
=head2 Password
UPS account password
=head2 config
Optionally you can retrieve all or some UPS webservice credentials from a
configuration file. This accessor holds the path to this file.
Defaults to C<~/.ups_tracking>
Example configuration file:
<?xml version="1.0"?>
<UPS_tracing_webservice_config>
<AccessLicenseNumber>1CFFED5A5E91B17</AccessLicenseNumber>
<UserId>myupsuser</UserId>
<Password>secret</Password>
</UPS_tracing_webservice_config>
=cut
has 'config' => (
is => 'rw',
isa => 'Str',
default => sub {
Path::Class::File->new( $ENV{HOME}, '.ups_tracking' )->stringify;
},
documentation => 'UPS tracking webservice access config file'
);
has 'AccessLicenseNumber' => (
is => 'rw',
required => 1,
isa => 'Str',
lazy_build => 1,
predicate => '_has_AccessLicenseNumber',
( run in 1.767 second using v1.01-cache-2.11-cpan-d8267643d1d )