Jeff Nokes > eBay-API-0.22 > eBay::API::BaseApi

Download:
eBay-API-0.22.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: eBay-API-0.25

eBay::API::BaseApi ^

Logging, exception handling and authentication frameworks for eBay::API objects.

DESCRIPTION ^

This top-level module encapsulates all the functionality for the eBay API. This library is really a parent class wrapper to the sub-classes of eBay::API--mainly sessions and api call objects.

The main purpose of this framework is to provide event logging, exception handling, and management eBay API certification information.

Users of eBay::API can use this facility to debug requests to the eBay API and responses from the eBay API. Unless the user overrides the default behavior, all logging will go to stderr.

Subroutines ^

Below is a list of public methods accessed through child classes.

setLogHeader()

Instance method to enable or disable additional context information to display with log messages. This information includes date, time, and logging level.

Arguments:

Returns:

logDebug()

Public convenience method to log debug messages. This is the same as doing

  $rc = $api->logMessage(eBay::API::BaseApi::LOG_DEBUG, "This is debug message.\n");

Arguments:

Returns:

logInfo()

Public convenience method to log info messages. This is the same as doing

  $rc = $api->logMessage(eBay::API::BaseApi::LOG_INFO, "This is an info message.\n");

Arguments:

Returns:

logError()

Public convenience method to log error messages. This is the same as doing

  $rc = $api->logMessage(eBay::API::BaseApi::LOG_ERROR, "This is an error message.\n");

Arguments:

Returns:

logMessage()

Description: Instance method to log application events. This is the main entry point for logging messages that should be filtered depending on the setting for the logging level. If the logging level of the message is lower than the current default logging level, the message will NOT be logged.

Arguments:

Returns:

logXml()

Description: Instance method to log application xml text. This is mainly a wrapper to logMessage() and takes the same arguments. This method assumes the message text is valid xml and will use XML::Tidy to clean it up some before logging it.

If the xml cannot be parsed and cleaned up, it will just be logged 'as is'.

Warning: XML::Tidy does not handle headers like

  <?xml version="1.0" encoding="utf-8" ?>

and will DELETE them from the message.

Arguments:

Returns:

setLogSubHandle()

Sets the class variable, $LOG_SUB_HANDLE, which allows users to customize all of its logging features, and those of it's children. The only required argument is a reference to a subroutine that should be able to accept a single scalar argument. By setting this, all logging normally performed by this and child modules will be tasked to the user provided handler.

Arguments:

Returns:

getLogSubHandle()

Returns a reference to a subroutine handling logging messages if one has been set by setLogSubHandle() previously.

Arguments:

Returns:

setLogFileHandle()

Sets a custom log file handle, which will allow users of this module to customize all of its logging features, and those of it's children. The log file handle argument is a typeglob (or reference to a typeglob; e.g. \*STDOUT) of a file handle that the user wishes all error/app logging be sent to, instead of the default STDERR. By setting this, all logging normally performed by this and child modules will be sent to the user provided file handle.

Arguments:

Returns:

getLogFileHandle()

Returns the current log file handle. If this had not been previously set by the user of the module, it should return STDERR.

Arguments: none

Returns:

testLogEntry()

Testing any user-specific overrides to default log output file or logging handler subroutine.

Arguments:

Returns:

dumpObject()

Instance method use mostly for debugging. It will dump the entire structure of an object. If an object is supplied as an argument, that object will be dumped; otherwise the instance of the class calling this method will be dumped in its entirety.

By design, the dump will use the protected logging method _logThis(), so whatever settings the user has to override the default logging, that where it will go, hopefully ...

You need to have log level DEBUG set for this to actually log anything.

Arguments:

Returns:

setLogLevel()

Setter method for setting the logging level of eBay::API and all child classes. Log levels may be set with any of the following constants.

Arguments:

Returns:

getLogLevel()

Get the current logging level. See setLoglevel() for details on the logging levels supported.

Arguments: none

Returns:

setDevID()

Sets the dev id for api certification. This variable is set to default to the value of $ENV{EBAY_API_DEV_ID}. You can override this either when constructing a session object or by using this method after construction of the session.

Arguments:

Returns:

getDevID()

Gets the current dev id setting.

Arguments:

Returns:

setAppID()

Sets the app id for ebay certification. This value defaults to $ENV{EBAY_API_APP_ID}, and is overridden either by calling this method or if it is specified when constructing a session object.

Arguments:

Returns:

getAppID()

Get the current app id for the session.

Arguments:

Returns:

setCertID()

Sets the cert id for the session. This overrides any default in $ENV{EBAY_API_CERT_ID}, or any value specified when the session was originally constructed.

Arguments:

Returns:

getCertID()

Gets current cert id.

Arguments:

Returns:

setSiteID()

Instance method to set the site id for the current session. This will override any global setting of the site id that was set at the package level by the environment variable $ENV{EBAY_API_SITE_ID}, or when a Session object is first constructed.

Arguments:

Returns:

getSiteID()

Returns the current site id for the current session. Note that this may be different than the global site id for the package.

Arguments:

Returns:

setUserName()

Instance method to set the application user name for the current session. This will override any global setting of the user name that was set at the package level by the environment variable $ENV{EBAY_API_USER_NAME}, or when a Session object is first constructed.

Arguments:

Returns:

getUserName()

Returns the current application user name for the current session. Note that this may be different than the global user name for the package.

Arguments:

Returns:

setUserPassword()

Instance method to set the application user password for the current session. This will override any global setting of the user password that was set at the package level by the environment variable $ENV{EBAY_API_USER_PASSWORD}, or when an API object is first constructed.

Arguments:

Returns:

getUserPassword()

Returns the current application user password for the current session. Note that this may be different than the global user password for the package.

Arguments:

Returns:

getError()

Instance getter method for retrieving the generic error for currrent state of the session. Consult the other information such as the logs, or the status of other api objects such as api call objects for more detailed error information. If all requests have completed successfully, there will be no error information. If any of the requests have had an error, then there will some message to this effect.

Arguments:

Returns:

isSuccess()

Indicates general status of the eBay::API object (usually a session, or an API call itself). Call this after execute() to see if errors were encountered.

Arguments: none

Returns:

setAuthToken()

Instance method to set the application user auth token for the current session. This will override any global setting of the user auth token that was set at the package level by the environment variable $ENV{EBAY_API_AUTH_TOKEN}, or when an API object is first constructed.

Arguments:

Returns:

getAuthToken()

Returns the current application user auth token for the current session. Note that this may be different than the global user auth token for the package.

Arguments:

Returns:

setCompatibilityLevel()

Instance method to set the XML API compatibility level for the current session. This will override any global default setting at the package level.

Note that the compatibility level is defaulted with each release of the API. However you can override that default with the environment variable, $ENV{EBAY_API_COMPATIBILITY_LEVEL}, when you construct a session object, or by using this setter method.

Arguments:

Returns:

getCompatibilityLevel()

Returns the XML API compatibility level for the current session. Note that this may be different than the global default for the package.

Arguments:

Returns:

setVersion()

Instance method to set the api version to something other than the default value, or the value specified when an eBay::API object was instantiated.

Arguments:

Returns:

getVersion()

Instance getter method for getting the current ebay api version level to be used.

Arguments:

Returns:

setCompression()

Enables/disables compression in the HTTP header. This tells the API whether the client application can accept gzipped content or not. Do not set this unless you have CPAN module Compress::Zlib.

Arguments:

Returns:

isCompression()

Indicates if gzip compression has been requested from the API.

Arguments:

Returns:

new()

Object constructor for the eBay::API::XML::Session class. This is basically a wrapper around the CPAN LWP::Paralle module.

Usage:

Arguments:

Returns:

setTimeout()

Call this instance method to set the number of seconds a session or a call should wait for the eBay XML API web services to respond to a request. This parameter controls the behavior of the call retry logic.

Arguments:

Returns:

getTimeout()

Call this instance method to get the number of seconds a session or a call should wait for the eBay XML API web services to respond to a request. This parameter controls the behavior of the call retry logic.

Arguments:

Returns:

setCallRetry()

Call this instance method to set the number of times a session or a call should retry an eBay XML API web service before giving up. This parameter controls the behavior of the call retry logic.

Arguments:

Returns:

getCallRetry()

Call this instance method to get any eBay::API::XML::CallRetry object that has previously been set to control retry behavior.

Arguments:

Returns:

getApiReleaseNumber()

Modifier: static Access: public Note: Returns the SDK's release number

enableParameterChecks()

Public package method to enable run-time validation of arguments to subroutines in the eBay::API package. Checking is enabled by default, but you may want to disable checking in production to reduce overhead. Having checking enabled is probably most useful during development of your application.

This method is both a getter and a setter.

Usage:

  if (eBay::API::BaseApi::enableParameterChecks()) {
    eBay::API::BaseApi::enableParameterChecks(0);
  }

Arguments:

Returns:

syntax highlighting: