.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Business::US::USPS::WebTools 3pm" .TH Business::US::USPS::WebTools 3pm "2021-05-20" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Business::US::USPS::WebTools \- Use the US Postal Service Web Tools .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Business::US::USPS::WebTools; \& \& # see subclasses for API details .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" *** \s-1THIS IS ALPHA SOFTWARE\s0 *** .PP This is the base class for the WebTools web service from the \s-1US\s0 Postal Service. The \s-1USPS\s0 offers several services, and this module handles the parts common to all of them: making the request, getting the response, parsing error reponses, and so on. The interesting stuff happens in one of the subclasses which implement a particular service. So far, the only subclass in this distribution is \&\f(CW\*(C`Business::US::USPS::WebTools::AddressStandardization\*(C'\fR. .IP "new( \s-1ANONYMOUS_HASH\s0 )" 4 .IX Item "new( ANONYMOUS_HASH )" Make the web service object. Pass is an anonymous hash with these keys: .Sp .Vb 3 \& UserID the user id provided by the USPS \& Password the password provided by the USPS \& Testing true or false, to select the right server .Ve .Sp If you don't pass the UserID or Password entries, \f(CW\*(C`new\*(C'\fR looks in the environment variables \s-1USPS_WEBTOOLS_USERID\s0 and \s-1USPS_WEBTOOLS_PASSWORD.\s0 .Sp If \f(CW\*(C`new\*(C'\fR cannot find both the User \s-1ID\s0 and the Password, it croaks. .Sp If you pass a true value with the Testing key, the object will use the testing server host name and the testing \s-1URL\s0 path. If the Testing key is false or not present, the object uses the live server details. .IP "userid" 4 .IX Item "userid" Returns the User \s-1ID\s0 for the web service. You need to get this from the \&\s-1US\s0 Postal Service. .IP "password" 4 .IX Item "password" Returns the Password for the web service. You need to get this from the \&\s-1US\s0 Postal Service. .IP "url" 4 .IX Item "url" Returns the \s-1URL\s0 for the request to the web service. So far, all requests are \s-1GET\s0 request with all of the data in the query string. .IP "tx" 4 .IX Item "tx" Returns the transaction from the Mojo::UserAgent request. .IP "response" 4 .IX Item "response" Returns the response from the web service. This is the slightly modified response. So far it only fixes up line endings and normalizes some error output for inconsistent responses from different physical servers. .IP "is_error" 4 .IX Item "is_error" Returns true if the response to the last request was an error, and false otherwise. .Sp If the response was an error, this method sets various fields in the object: .Sp .Vb 5 \& $self\->{error}{number} \& $self\->{error}{source} \& $self\->{error}{description} \& $self\->{error}{help_file} \& $self\->{error}{help_context} .Ve .IP "live_server_host" 4 .IX Item "live_server_host" This is production.shippingapis.com. The modules choose this host when you have not set \f(CW\*(C`Testing\*(C'\fR to a true value. .IP "test_server_host" 4 .IX Item "test_server_host" For most APIs, this is testing.shippingapis.com. The modules choose this host when you have set \f(CW\*(C`Testing\*(C'\fR to a true value. .SH "SEE ALSO" .IX Header "SEE ALSO" The WebTools \s-1API\s0 is documented on the \s-1US\s0 Postal Service's website: .PP .Vb 1 \& http://www.usps.com/webtools/htm/Address\-Information.htm .Ve .SH "SOURCE AVAILABILITY" .IX Header "SOURCE AVAILABILITY" This source is in GitHub: .PP .Vb 1 \& https://github.com/ssimms/business\-us\-usps\-webtools .Ve .SH "AUTHOR" .IX Header "AUTHOR" brian d foy .SH "MAINTAINER" .IX Header "MAINTAINER" Steve Simms .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright © 2020, Steve Simms. All rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.