Class Zend_Gdata_App

Description

Provides Atom Publishing Protocol (APP) functionality. This class and all other components of Zend_Gdata_App are designed to work independently from other Zend_Gdata components in order to interact with generic APP services.

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Gdata/App.php (line 55)


	
			
Direct descendents
Class Description
 class Zend_Gdata Provides functionality to interact with Google data APIs Subclasses exist to implement service-specific features
Class Constant Summary
Variable Summary
Method Summary
 static boolean getGzipEnabled ()
 static boolean getHttpMethodOverride ()
 static int getMaxRedirects ()
 static boolean getVerboseExceptionMessages ()
 static string|Zend_Gdata_App_Feed import (string $uri, [Zend_Http_Client $client = null], [string $className = 'Zend_Gdata_App_Feed'])
 static Zend_Gdata_App_Feed importFile (string $filename, [string $className = 'Zend_Gdata_App_Feed'], [string $useIncludePath = false])
 static Zend_Gdata_App_Feed importString (string $string, [string $className = 'Zend_Gdata_App_Feed'], [ $majorProtocolVersion = null], [ $minorProtocolVersion = null], integer $majorProcolVersion, integer $minorProcolVersion)
 static void setGzipEnabled ([boolean $enabled = false])
 static void setHttpMethodOverride ([boolean $override = true])
 static void setMaxRedirects (int $maxRedirects)
 static void setStaticHttpClient ( $httpClient)
 static void setVerboseExceptionMessages (boolean $verbose)
 Zend_Gdata_App __construct ([Zend_Http_Client $client = null], [string $applicationId = 'MyCompany-MyApp-1.0'])
 void delete (mixed $data, [ $remainingRedirects = null])
 void enableRequestDebugLogging ($logfile $logfile)
 string|null generateIfMatchHeaderData ( $data,  $allowWeek, boolean $allowWeak)
 Zend_Http_Response get (string $uri, [array $extraHeaders = array()])
 string|Zend_Gdata_App_Entry getEntry (string $uri, [string $className = 'Zend_Gdata_App_Entry'])
 string|Zend_Gdata_App_Feed getFeed (string $uri, [string $className = 'Zend_Gdata_App_Feed'])
 (int|NULL) getMinorProtocolVersion ()
 Zend_Gdata_App_Feed|null getNextFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
 Zend_Gdata_App_Feed|null getPreviousFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
 string|Zend_Gdata_App_Feed importUrl (string $url, [string $className = 'Zend_Gdata_App_Feed'], [array $extraHeaders = array()])
 Zend_Gdata_App_Entry insertEntry (mixed $data, string $uri, [string $className = 'Zend_Gdata_App_Entry'], [array $extraHeaders = array()])
 Zend_Http_Response performHttpRequest (string $method, string $url, [array $headers = null], [string $body = null], [string $contentType = null], [int $remainingRedirects = null])
 Zend_Http_Response post (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
 array prepareRequest (string $method, [string $url = null], [array $headers = array()], [mixed $data = null], [string $contentTypeOverride = null])
 Zend_Http_Response put (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
 void registerPackage (string $name)
 mixed retrieveAllEntriesForFeed ($feed $feed)
 Zend_Gdata_App setHttpClient (Zend_Http_Client $client, [ $applicationId = 'MyCompany-MyApp-1.0'])
 void setMajorProtocolVersion (int $value)
 void setMinorProtocolVersion ((int|NULL) $value)
 Zend_Gdata_App_Entry updateEntry (mixed $data, [string|null $uri = null], [string|null $className = null], [array $extraHeaders = array()])
 void useObjectMapping (boolean $value)
 boolean usingObjectMapping ()
 void __call (string $method, array $args)
Variables
static boolean $_gzipEnabled = false (line 96)

Enable gzipped responses?

  • access: protected
static boolean $_httpMethodOverride = false (line 89)

Override HTTP PUT and DELETE request methods?

  • access: protected
static int $_maxRedirects = 5 (line 127)

Maximum number of redirects to follow during HTTP operations

  • access: protected
static Zend_Http_Client $_staticHttpClient = null (line 82)

Client object used to communicate in static context

  • access: protected

Redefined in descendants as:
static boolean $_verboseExceptionMessages = true (line 104)

Use verbose exception messages. In the case of HTTP errors, use the body of the HTTP response in the exception message.

  • access: protected
string $_defaultPostUri = null (line 111)

Default URI to which to POST.

  • access: protected

Redefined in descendants as:
Zend_Http_Client $_httpClient (line 75)

Client object used to communicate

  • access: protected

Redefined in descendants as:
mixed $_majorProtocolVersion (line 140)

Indicates the major protocol version that should be used.

At present, recognized values are either 1 or 2. However, any integer value >= 1 is considered valid.

Under most circumtances, this will be automatically set by Zend_Gdata_App subclasses.

mixed $_minorProtocolVersion (line 156)

Indicates the minor protocol version that should be used. Can be set to either an integer >= 0, or NULL if no minor version should be sent to the server.

At present, this field is not used by any Google services, but may be used in the future.

Under most circumtances, this will be automatically set by Zend_Gdata_App subclasses.

array $_registeredPackages = array(
'Zend_Gdata_App_Extension',
'Zend_Gdata_App')
(line 118)

Packages to search for classes when using magic __call method, in order.

  • access: protected

Redefined in descendants as:
boolean $_useObjectMapping = true (line 163)

Whether we want to use XML to object mapping when fetching data.

  • access: protected
Methods
static getGzipEnabled (line 348)

Get the HTTP override state

  • access: public
static boolean getGzipEnabled ()
static getHttpMethodOverride (line 320)

Get the HTTP override state

  • access: public
static boolean getHttpMethodOverride ()
static getMaxRedirects (line 395)

Get the maximum number of redirects to follow during HTTP operations

  • return: Maximum number of redirects to follow
  • access: public
static int getMaxRedirects ()
static getStaticHttpClient (line 282)

Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.

  • access: public
static Zend_Http_Client getStaticHttpClient ()
static getVerboseExceptionMessages (line 361)

Get whether to use verbose exception messages

In the case of HTTP errors, use the body of the HTTP response in the exception message.

  • access: public
static boolean getVerboseExceptionMessages ()
static import (line 719)

Imports a feed located at $uri.

  • return: Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
  • throws: Zend_Gdata_App_Exception
  • access: public
static string|Zend_Gdata_App_Feed import (string $uri, [Zend_Http_Client $client = null], [string $className = 'Zend_Gdata_App_Feed'])
  • string $uri
  • Zend_Http_Client $client: The client used for communication
  • string $className: The class which is used as the return type

Redefined in descendants as:
static importFile (line 833)

Imports a feed from a file located at $filename.

  • throws: Zend_Gdata_App_Exception
  • access: public
static Zend_Gdata_App_Feed importFile (string $filename, [string $className = 'Zend_Gdata_App_Feed'], [string $useIncludePath = false])
  • string $filename
  • string $className: The class which is used as the return type
  • string $useIncludePath: Whether the include_path should be searched
static importString (line 799)

Imports a feed represented by $string.

  • throws: Zend_Gdata_App_Exception
  • access: public
static Zend_Gdata_App_Feed importString (string $string, [string $className = 'Zend_Gdata_App_Feed'], [ $majorProtocolVersion = null], [ $minorProtocolVersion = null], integer $majorProcolVersion, integer $minorProcolVersion)
  • string $string
  • string $className: The class which is used as the return type
  • integer $majorProcolVersion: (optional) The major protocol version of the data model object that is to be created.
  • integer $minorProcolVersion: (optional) The minor protocol version of the data model object that is to be created.
  • $majorProtocolVersion
  • $minorProtocolVersion
static setGzipEnabled (line 331)

Toggle requesting gzip encoded responses

  • access: public
static void setGzipEnabled ([boolean $enabled = false])
  • boolean $enabled: Whether or not to enable gzipped responses
static setHttpMethodOverride (line 310)

Toggle using POST instead of PUT and DELETE HTTP methods

Some feed implementations do not accept PUT and DELETE HTTP methods, or they can't be used because of proxies or other measures. This allows turning on using POST where PUT and DELETE would normally be used; in addition, an X-Method-Override header will be sent with a value of PUT or DELETE as appropriate.

  • access: public
static void setHttpMethodOverride ([boolean $override = true])
  • boolean $override: Whether to override PUT and DELETE with POST.
static setMaxRedirects (line 385)

Set the maximum number of redirects to follow during HTTP operations

  • access: public
static void setMaxRedirects (int $maxRedirects)
  • int $maxRedirects: Maximum number of redirects to follow
static setStaticHttpClient (line 271)

Set the static HTTP client instance

Sets the static HTTP client object to use for retrieving the feed.

  • access: public
static void setStaticHttpClient ( $httpClient)
static setVerboseExceptionMessages (line 374)

Set whether to use verbose exception messages

In the case of HTTP errors, use the body of the HTTP response in the exception message.

  • access: public
static void setVerboseExceptionMessages (boolean $verbose)
  • boolean $verbose: Whether to use verbose exception messages
Constructor __construct (line 171)

Create Gdata object

  • access: public
Zend_Gdata_App __construct ([Zend_Http_Client $client = null], [string $applicationId = 'MyCompany-MyApp-1.0'])

Redefined in descendants as:
delete (line 923)

DELETE entry with client object

  • throws: Zend_Gdata_App_Exception
  • throws: Zend_Gdata_App_HttpException
  • throws: Zend_Gdata_App_InvalidArgumentException
  • access: public
void delete (mixed $data, [ $remainingRedirects = null])
  • mixed $data: The Zend_Gdata_App_Entry or URL to delete
  • $remainingRedirects

Redefined in descendants as:
  • Zend_Gdata_Gapps::delete() : DELETE entry with client object This method overrides the default behavior of Zend_Gdata_App, providing support for Zend_Gdata_Gapps_ServiceException.
enableRequestDebugLogging (line 1098)

This method enables logging of requests by changing the Zend_Http_Client_Adapter used for performing the requests.

NOTE: This will not work if you have customized the adapter already to use a proxy server or other interface.

  • access: public
void enableRequestDebugLogging ($logfile $logfile)
  • $logfile $logfile: The logfile to use when logging the requests
generateIfMatchHeaderData (line 1169)

Returns the data for an If-Match header based on the current Etag property. If Etags are not supported by the server or cannot be extracted from the data, then null will be returned.

  • access: public
string|null generateIfMatchHeaderData ( $data,  $allowWeek, boolean $allowWeak)
  • boolean $allowWeak: If false, then if a weak Etag is detected, then return null rather than the Etag.
  • $data
  • $allowWeek
get (line 856)

GET a URI using client object.

  • throws: Zend_Gdata_App_HttpException
  • access: public
Zend_Http_Response get (string $uri, [array $extraHeaders = array()])
  • string $uri: GET URI
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.

Redefined in descendants as:
getEntry (line 218)

Retrieve entry as string or object

  • return: Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
  • access: public
string|Zend_Gdata_App_Entry getEntry (string $uri, [string $className = 'Zend_Gdata_App_Entry'])
  • string $uri
  • string $className: The class which is used as the return type

Redefined in descendants as:
getFeed (line 203)

Retrieve feed as string or object

  • return: Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
  • access: public
string|Zend_Gdata_App_Feed getFeed (string $uri, [string $className = 'Zend_Gdata_App_Feed'])
  • string $uri: The uri from which to retrieve the feed
  • string $className: The class which is used as the return type

Redefined in descendants as:
getHttpClient (line 228)

Get the Zend_Http_Client object used for communication

  • access: public
Zend_Http_Client getHttpClient ()
getMajorProtocolVersion (line 424)

Get the major protocol version that is in use.

int getMajorProtocolVersion ()
getMinorProtocolVersion (line 455)

Get the minor protocol version that is in use.

(int|NULL) getMinorProtocolVersion ()
getNextFeed (line 1118)

Retrieve next set of results based on a given feed.

  • return: Returns a Zend_Gdata_App_Feed or null if no next set of results exists.
  • access: public
Zend_Gdata_App_Feed|null getNextFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
  • Zend_Gdata_App_Feed $feed: The feed from which to retreive the next set of results.
  • string $className: (optional) The class of feed to be returned. If null, the next feed (if found) will be the same class as the feed that was given as the first argument.
getPreviousFeed (line 1145)

Retrieve previous set of results based on a given feed.

  • return: Returns a Zend_Gdata_App_Feed or null if no previous set of results exists.
  • access: public
Zend_Gdata_App_Feed|null getPreviousFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
  • Zend_Gdata_App_Feed $feed: The feed from which to retreive the previous set of results.
  • string $className: (optional) The class of feed to be returned. If null, the previous feed (if found) will be the same class as the feed that was given as the first argument.
importUrl (line 751)

Imports the specified URL (non-statically).

  • return: Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
  • throws: Zend_Gdata_App_Exception
  • access: public
string|Zend_Gdata_App_Feed importUrl (string $url, [string $className = 'Zend_Gdata_App_Feed'], [array $extraHeaders = array()])
  • string $url: The URL to import
  • string $className: The class which is used as the return type
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
insertEntry (line 953)

Inserts an entry to a given URI and returns the response as a fully formed Entry.

  • return: The entry returned by the service after insertion.
  • access: public
Zend_Gdata_App_Entry insertEntry (mixed $data, string $uri, [string $className = 'Zend_Gdata_App_Entry'], [array $extraHeaders = array()])
  • mixed $data: The Zend_Gdata_App_Entry or XML to post
  • string $uri: POST URI
  • string $className: The class of entry to be returned.
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
performHttpRequest (line 589)

Performs a HTTP request using the specified method

  • return: The response object
  • access: public
Zend_Http_Response performHttpRequest (string $method, string $url, [array $headers = null], [string $body = null], [string $contentType = null], [int $remainingRedirects = null])
  • string $method: The HTTP method for the request - 'GET', 'POST', 'PUT', 'DELETE'
  • string $url: The URL to which this request is being performed
  • array $headers: An associative array of HTTP headers for this request
  • string $body: The body of the HTTP request
  • string $contentType: The value for the content type of the request body
  • int $remainingRedirects: Number of redirects to follow if request s results in one

Redefined in descendants as:
post (line 878)

POST data with client object

  • throws: Zend_Gdata_App_Exception
  • throws: Zend_Gdata_App_HttpException
  • throws: Zend_Gdata_App_InvalidArgumentException
  • access: public
Zend_Http_Response post (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
  • mixed $data: The Zend_Gdata_App_Entry or XML to post
  • string $uri: POST URI
  • array $headers: Additional HTTP headers to insert.
  • string $contentType: Content-type of the data
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
  • $remainingRedirects

Redefined in descendants as:
prepareRequest (line 483)

Provides pre-processing for HTTP requests to APP services.

  1. Checks the $data element and, if it's an entry, extracts the XML, multipart data, edit link (PUT,DELETE), etc.
  2. If $data is a string, sets the default content-type header as 'application/atom+xml' if it's not already been set.
  3. Adds a x-http-method override header and changes the HTTP method to 'POST' if necessary as per getHttpMethodOverride()

  • return: An associative array containing the determined 'method', 'url', 'data', 'headers', 'contentType'
  • access: public
array prepareRequest (string $method, [string $url = null], [array $headers = array()], [mixed $data = null], [string $contentTypeOverride = null])
  • string $method: The HTTP method for the request - 'GET', 'POST', 'PUT', 'DELETE'
  • string $url: The URL to which this request is being performed, or null if found in $data
  • array $headers: An associative array of HTTP headers for this request
  • mixed $data: The Zend_Gdata_App_Entry or XML for the body of the request
  • string $contentTypeOverride: The override value for the content type of the request body
put (line 903)

PUT data with client object

  • throws: Zend_Gdata_App_Exception
  • throws: Zend_Gdata_App_HttpException
  • throws: Zend_Gdata_App_InvalidArgumentException
  • access: public
Zend_Http_Response put (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
  • mixed $data: The Zend_Gdata_App_Entry or XML to post
  • string $uri: PUT URI
  • array $headers: Additional HTTP headers to insert.
  • string $contentType: Content-type of the data
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
  • $remainingRedirects

Redefined in descendants as:
  • Zend_Gdata_Gapps::put() : PUT data with client object This method overrides the default behavior of Zend_Gdata_App, providing support for Zend_Gdata_Gapps_ServiceException.
registerPackage (line 188)

Adds a Zend Framework package to the $_registeredPackages array.

This array is searched when using the magic __call method below to instantiante new objects.

  • access: public
void registerPackage (string $name)
  • string $name: The name of the package (eg Zend_Gdata_App)
retrieveAllEntriesForFeed (line 1070)

Retrieve all entries for a feed, iterating through pages as necessary.

Be aware that calling this function on a large dataset will take a significant amount of time to complete. In some cases this may cause execution to timeout without proper precautions in place.

  • return: A new feed of the same type as the one originally passed in, containing all relevent entries.
  • access: public
mixed retrieveAllEntriesForFeed ($feed $feed)
  • $feed $feed: The feed to iterate through.
setHttpClient (line 240)

Set the Zend_Http_Client object used for communication

  • return: Provides a fluent interface
  • throws: Zend_Gdata_App_HttpException
  • access: public
Zend_Gdata_App setHttpClient (Zend_Http_Client $client, [ $applicationId = 'MyCompany-MyApp-1.0'])

Redefined in descendants as:
setMajorProtocolVersion (line 408)

Set the major protocol version that should be used. Values < 1 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.

void setMajorProtocolVersion (int $value)
  • int $value: The major protocol version to use.
setMinorProtocolVersion (line 438)

Set the minor protocol version that should be used. If set to NULL, no minor protocol version will be sent to the server. Values < 0 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.

void setMinorProtocolVersion ((int|NULL) $value)
  • (int|NULL) $value: The minor protocol version to use.
updateEntry (line 983)

Update an entry

  • return: The entry returned from the server
  • throws: Zend_Gdata_App_Exception
  • access: public
Zend_Gdata_App_Entry updateEntry (mixed $data, [string|null $uri = null], [string|null $className = null], [array $extraHeaders = array()])
  • mixed $data: Zend_Gdata_App_Entry or XML (w/ID and link rel='edit')
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
  • string|null $uri: The URI to send requests to, or null if $data contains the URI.
  • string|null $className: The name of the class that should be deserialized from the server response. If null, then 'Zend_Gdata_App_Entry' will be used.
useObjectMapping (line 1202)

Enable/disable the use of XML to object mapping.

  • access: public
void useObjectMapping (boolean $value)
  • boolean $value: Pass in true to use the XML to object mapping. Pass in false or null to disable it.
usingObjectMapping (line 1190)

Determine whether service object is using XML to object mapping.

  • return: True if service object is using XML to object mapping, false otherwise.
  • access: public
boolean usingObjectMapping ()
__call (line 1017)

Provides a magic factory method to instantiate new objects with

shorter syntax than would otherwise be required by the Zend Framework naming conventions. For instance, to construct a new Zend_Gdata_Calendar_Extension_Color, a developer simply needs to do $gCal->newColor(). For this magic constructor, packages are searched in the same order as which they appear in the $_registeredPackages array

  • throws: Zend_Gdata_App_Exception
  • access: public
void __call (string $method, array $args)
  • string $method: The method name being called
  • array $args: The arguments passed to the call

Redefined in descendants as:
  • Zend_Gdata_Gapps::__call() : Provides a magic factory method to instantiate new objects with shorter syntax than would otherwise be required by the Zend Framework naming conventions. For more information, see Zend_Gdata_App::__call().
Class Constants
DEFAULT_MAJOR_PROTOCOL_VERSION = 1 (line 62)

Default major protocol version.

DEFAULT_MINOR_PROTOCOL_VERSION = null (line 68)

Default minor protocol version.

Documentation generated on Mon, 21 Jun 2010 15:07:33 -0400 by phpDocumentor 1.4.3