Base class for implementation of the google apis
This class is not meant to be used directly. Instead use VUser::Google::ApiProtocol::V2_0.
These are the members of the ApiProtocol class. You get and set the values by using the method of the same name. For example:
# Get the domain from the ApiProtocol object my $domain = $google->domain; # Set the domain $google->domain('myappsdomain.com');
Most of the member can be set when the object is created with \*(C`new()\*(C'.
my $google = VUser::ApiProtocol->new( domain => 'myappsdomain.com' );
Note: VUser::Google::ApiProtocol is not meant to be used directly. Please see the version specific subclasses, such as VUser::Google::ApiProtocol::V2_0, to create a usable object.
The administrative user. This user must have be set as an admin in the Google Apps control panel. Also, be sure to log into the Google Apps control panel once with this user to accept all of the legal garbage or you will see intermittent auth errors.
Turn on debugging output.
The Google Apps domain to work on.
The plain text password of the admin user.
If set to a true value, \*(C`Login()\*(C' will refresh the authentication token even if it's not necessary.
The unix timestamp of the last authentication.
The authentication token retrieved from Google on a successful login. The token is only valid for 24 hours.
The \s-1HTTP\s0 headers of the last reply
The \s-1HTTP\s0 content of the last reply
The resulting hash from the last reply data as parsed by XML::Simple
The user agent VUser::Google::ApiProtocol uses when talking to Google. It is set to the classname/version. For example, VUser::Google::ApiProtocol::V2_0/0.25.
Create a new ApiProtocol object. Any read-write member may be set in the call to \*(C`new()\*(C'.
Login to the Google \s-1API\s0. \*(C`Login()\*(C' takes no parameters. Instead, you must set the \*(C`domain\*(C', \*(C`admin\*(C', and \*(C`password\*(C' members, then call \*(C`Login()\*(C'.
\*(C`Login()\*(C' will use the existing authentication token if it exists and hasn't yet timed out. You may force it to do a full re-authentication by setting \*(C`refresh_token\*(C' to a true value before calling \*(C`Login()\*(C'.
Returns true if the object thinks that it has already authenticated and the token hasn't timed out and a false value otherwise.
Note: \*(C`IsAuthenticated()\*(C' only knows if there's an authtoken and if it's still fresh. It may be possible for Google to decide that a token is not valid which \*(C`IsAuthenticated()\*(C' cannot check. Sends an \s-1API\s0 request to Google.
$method is the \s-1HTTP\s0 method to use, e.g. \s-1GET\s0, \s-1POST\s0, etc. Note: Many of the \s-1API\s0 calls use different methods. Double check the \s-1API\s0 docs to make sure you are using the correct method.
$url is the url to use to make the \s-1API\s0 call. The URLs are defined in the \s-1API\s0 docs.
$body is the \s-1XML\s0 specific action. Again, see the \s-1API\s0 docs for the specific format for each \s-1API\s0 call. $body is not needed when the method is \s-1GET\s0 or \s-1DELETE\s0.
Prints $message to \s-1STDERR\s0 if \*(C`debug\*(C' is set to a true value.
XML::Simple
Randy Smith <[email protected]>