| 1 | package VR::API::Partner; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | use VR::API; | ||
| 5 | use base qw( VR::API ); | ||
| 6 | |||
| 7 | our $VERSION = $VR::API::VERSION; | ||
| 8 | |||
| 9 | sub _methods { | ||
| 10 | my @enterprise_methods = VR::API::_methods( ); | ||
| 11 | return @enterprise_methods, qw( | ||
| 12 | createCompany | ||
| 13 | createUser | ||
| 14 | enumerateCompanies | ||
| 15 | ); | ||
| 16 | } | ||
| 17 | |||
| 18 | BEGIN { | ||
| 19 | VR::API::_manufacture_methods( __PACKAGE__ ); | ||
| 20 | } | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | VR::API - Communicate with VerticalResponse's API services as a partner (privileged) user | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | VR::API::Partner extends VR::API with certain methods that are only available when the | ||
| 29 | user communicates with the VR API servers using a signed SSL certificate, which securely | ||
| 30 | identifies the user as VerticalResponse partner. | ||
| 31 | |||
| 32 | Contact api-support@verticalresponse.com for information on becoming a VR API Partner. | ||
| 33 | |||
| 34 | =head2 Example | ||
| 35 | |||
| 36 | #!/usr/bin/perl -w | ||
| 37 | use strict; | ||
| 38 | use VR::API::Partner; | ||
| 39 | |||
| 40 | # SOAP::Lite uses Crypt::SSLeay for client-side certificate management. | ||
| 41 | # perldoc Crypt::SSLeay for more documentation on how these environment | ||
| 42 | # variables are used. | ||
| 43 | $ENV{HTTPS_PKCS12_FILE} = "nickverticalresponsecom.p12"; | ||
| 44 | $ENV{HTTPS_PKCS12_PASSWORD} = "a_secret"; # Not needed for passphraseless PKCS#12 keystores | ||
| 45 | |||
| 46 | # Log in to the main partner account | ||
| 47 | my $vrapi = new VR::API::Partner; | ||
| 48 | $vrapi->login( { | ||
| 49 | username => 'nick@verticalresponse.com', | ||
| 50 | password => 'another_secret', | ||
| 51 | } ); | ||
| 52 | |||
| 53 | # Bring a sub-account's balance up to 100 email credits | ||
| 54 | my $balance = $vrapi->getEmailCreditBalance( { | ||
| 55 | company_id => 5678 # A sub-account managed by this partner | ||
| 56 | } ); | ||
| 57 | |||
| 58 | if( $balance < 100 ) { | ||
| 59 | $vrapi->transferEmailCredits( { | ||
| 60 | from_company_id => 1234, # The partner's main account | ||
| 61 | to_company_id => 5678, # The sub-account that needs email credits | ||
| 62 | credits_to_transfer => 100 - $balance, | ||
| 63 | } ); | ||
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | =head2 Available functions | ||
| 68 | |||
| 69 | See VR::API::Partner::_methods() for a list of available functions. These | ||
| 70 | functions correspond to the functions listed in the VR API Partner WSDL file. | ||
| 71 | |||
| 72 | Note that it is not necessary to send the 'session_id' parameter with each | ||
| 73 | method call; the VR::API infrastructure does that automatically after a | ||
| 74 | successful call to login(). | ||
| 75 | |||
| 76 | =head2 References | ||
| 77 | |||
| 78 | Partner API (requires a valid partner certificate): | ||
| 79 | |||
| 80 | L<https://api.verticalresponse.com/partner-wsdl/1.0/VRAPI.wsdl> | ||
| 81 | L<https://api.verticalresponse.com/partner-wsdl/1.0/documentation.html> | ||
| 82 | |||
| 83 | =head1 SEE ALSO | ||
| 84 | |||
| 85 | L<VR::API>, the VR Enterprise API Perl module | ||
| 86 | |||
| 87 | =head1 COPYRIGHT | ||
| 88 | |||
| 89 | Copyright (C) 2007, Nick Marden, VerticalResponse Inc. | ||
| 90 | |||
| 91 | VR::API::Partner.pm is free software; you can redistribute it and/or modify | ||
| 92 | it under the terms of the GNU General Public License as published by | ||
| 93 | the Free Software Foundation; either version 2 of the License, or | ||
| 94 | (at your option) any later version. | ||
| 95 | |||
| 96 | VR::API::Partner.pm is distributed in the hope that it will be useful, | ||
| 97 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 98 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 99 | GNU General Public License for more details. | ||
| 100 | |||
| 101 | You should have received a copy of the GNU General Public License | ||
| 102 | along with this program; if not, write to the Free Software | ||
| 103 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | 1; |