diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Gdata/Books.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Gdata/Books.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,204 @@ +registerPackage('Zend_Gdata_Books'); + $this->registerPackage('Zend_Gdata_Books_Extension'); + parent::__construct($client, $applicationId); + $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); + } + + /** + * Retrieves a feed of volumes. + * + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query or a Zend_Gdata_Query object from which a URL can be + * determined. + * @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the + * specified URL. + */ + public function getVolumeFeed($location = null) + { + if ($location == null) { + $uri = self::VOLUME_FEED_URI; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); + } + + /** + * Retrieves a specific volume entry. + * + * @param string|null $volumeId The volumeId of interest. + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query or a Zend_Gdata_Query object from which a URL can be + * determined. + * @return Zend_Gdata_Books_VolumeEntry The feed of volumes found at the + * specified URL. + */ + public function getVolumeEntry($volumeId = null, $location = null) + { + if ($volumeId !== null) { + $uri = self::VOLUME_FEED_URI . "/" . $volumeId; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry'); + } + + /** + * Retrieves a feed of volumes, by default the User library feed. + * + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query. + * @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the + * specified URL. + */ + public function getUserLibraryFeed($location = null) + { + if ($location == null) { + $uri = self::MY_LIBRARY_FEED_URI; + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); + } + + /** + * Retrieves a feed of volumes, by default the User annotation feed + * + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query. + * @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the + * specified URL. + */ + public function getUserAnnotationFeed($location = null) + { + if ($location == null) { + $uri = self::MY_ANNOTATION_FEED_URI; + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); + } + + /** + * Insert a Volume / Annotation + * + * @param Zend_Gdata_Books_VolumeEntry $entry + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query + * @return Zend_Gdata_Books_VolumeEntry The inserted volume entry. + */ + public function insertVolume($entry, $location = null) + { + if ($location == null) { + $uri = self::MY_LIBRARY_FEED_URI; + } else { + $uri = $location; + } + return parent::insertEntry( + $entry, $uri, 'Zend_Gdata_Books_VolumeEntry'); + } + + /** + * Delete a Volume + * + * @param Zend_Gdata_Books_VolumeEntry $entry + * @return void + */ + public function deleteVolume($entry) + { + $entry->delete(); + } + +}