package WebService::Avalara::AvaTax::Role::Connection; # ABSTRACT: Common attributes and methods for AvaTax use strict; use warnings; our $VERSION = '0.020'; # VERSION use utf8; #pod =head1 SYNOPSIS #pod #pod use Moo; #pod with 'WebService::Avalara::AvaTax::Role::Connection'; #pod #pod =head1 DESCRIPTION #pod #pod This role factors out the common attributes and methods used by the #pod Avalara AvaTax (C) #pod web service interface. #pod #pod =cut use Log::Report; use LWP::UserAgent; use LWPx::UserAgent::Cached; use Moo::Role; use Mozilla::CA; use Types::Standard qw(Bool InstanceOf Str); use namespace::clean; #pod =attr username #pod #pod The Avalara AvaTax Admin Console user name. Usually an email address. Required. #pod #pod =cut has username => ( is => 'ro', isa => Str, required => 1 ); #pod =attr password #pod #pod The password used for Avalara authentication. Required. #pod #pod =cut has password => ( is => 'ro', isa => Str, required => 1 ); #pod =attr use_wss #pod #pod A boolean value that indicates whether or not to use WSS security tokens in #pod the SOAP header or to use those specified in Avalara's alternate security WSDL. #pod Defaults to true. Normally you should leave this alone unless your application #pod does not work correctly with WSS. #pod #pod =cut has use_wss => ( is => 'rwp', isa => Bool, default => 1 ); #pod =attr is_production #pod #pod A boolean value that indicates whether to connect to the production AvaTax #pod services (true) or development (false). Defaults to false. #pod #pod =cut has is_production => ( is => 'ro', isa => Bool, default => 0 ); #pod =attr debug #pod #pod When set to true, the L dispatcher used by #pod L and friends is set to I mode. #pod #pod =cut has debug => ( is => 'ro', isa => Bool, default => 0, trigger => sub { dispatcher( mode => ( $_[1] ? 'DEBUG' : 'NORMAL' ), 'ALL' ) }, ); #pod =attr user_agent #pod #pod An instance of an L (sub-)class. You can #pod use your own subclass to add features such as caching or enhanced logging. #pod #pod If you do not specify a C then we default to an instance of #pod L. Note that we also set #pod the C environment variable to the result from #pod L in order to correctly #pod resolve certificate names. #pod #pod =cut BEGIN { ## no critic (Subroutines::ProhibitCallsToUnexportedSubs) ## no critic (Variables::RequireLocalizedPunctuationVars) $ENV{HTTPS_CA_FILE} = Mozilla::CA::SSL_ca_file(); } has user_agent => ( is => 'lazy', isa => InstanceOf ['LWP::UserAgent'], default => sub { LWPx::UserAgent::Cached->new }, ); 1; __END__ =pod =for :stopwords Mark Gardner ZipRecruiter cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 NAME WebService::Avalara::AvaTax::Role::Connection - Common attributes and methods for AvaTax =head1 VERSION version 0.020 =head1 SYNOPSIS use Moo; with 'WebService::Avalara::AvaTax::Role::Connection'; =head1 DESCRIPTION This role factors out the common attributes and methods used by the Avalara AvaTax (C) web service interface. =head1 ATTRIBUTES =head2 username The Avalara AvaTax Admin Console user name. Usually an email address. Required. =head2 password The password used for Avalara authentication. Required. =head2 use_wss A boolean value that indicates whether or not to use WSS security tokens in the SOAP header or to use those specified in Avalara's alternate security WSDL. Defaults to true. Normally you should leave this alone unless your application does not work correctly with WSS. =head2 is_production A boolean value that indicates whether to connect to the production AvaTax services (true) or development (false). Defaults to false. =head2 debug When set to true, the L dispatcher used by L and friends is set to I mode. =head2 user_agent An instance of an L (sub-)class. You can use your own subclass to add features such as caching or enhanced logging. If you do not specify a C then we default to an instance of L. Note that we also set the C environment variable to the result from L in order to correctly resolve certificate names. =head1 SUPPORT =head2 Perldoc You can find documentation for this module with the perldoc command. perldoc WebService::Avalara::AvaTax =head2 Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * Search CPAN The default CPAN search engine, useful to view POD in HTML format. L =item * AnnoCPAN The AnnoCPAN is a website that allows community annotations of Perl module documentation. L =item * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. L =item * CPAN Forum The CPAN Forum is a web forum for discussing Perl modules. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. L =item * CPAN Testers Matrix The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 Source Code The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) L git clone git://github.com/mjgardner/WebService-Avalara-AvaTax.git =head1 AUTHOR Mark Gardner =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2016 by ZipRecruiter. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut