public function testGetEntryExceptionInvalidLocationType() { $gdata = new GData\GData(); try { // give it neither a string nor a Zend_GData_Query object, // and see if it throws an exception. $feed = $gdata->getEntry(new \stdClass()); $this->fail('Expecting to catch Zend\\GData\\App\\InvalidArgumentException'); } catch (\Zend\Exception $e) { $this->assertType('Zend\\GData\\App\\InvalidArgumentException', $e, 'Expecting Zend\\GData\\App\\InvalidArgumentException, got ' . get_class($e)); $this->assertEquals('You must specify the location as either a string URI or a child of Zend\\GData\\Query', $e->getMessage()); } }
/** * Gets a list entry. * * @param string $location A ListQuery or a URI specifying the entry location. * @return ListEntry */ public function getListEntry($location) { if ($location instanceof ListQuery) { $uri = $location->getQueryUrl(); } else { $uri = $location; } return parent::getEntry($uri, '\\Zend\\GData\\Spreadsheets\\ListEntry'); }
/** * Retreive a single EmailListRecipientEntry object. * * @param mixed $location The location for the feed, as a URL or Query. * @return \Zend\GData\GApps\EmailListRecipientEntry * @throws \Zend\GData\App\Exception * @throws \Zend\GData\App\HttpException * @throws \Zend\GData\GApps\ServiceException */ public function getEmailListRecipientEntry($location) { if ($location === null) { throw new App\InvalidArgumentException('Location must not be null'); } else { if ($location instanceof GData\Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } } return parent::getEntry($uri, '\\Zend\\GData\\GApps\\EmailListRecipientEntry'); }
public function testDisableAndReEnableXMLToObjectMappingReturnsObject() { $gdata = new GData\GData(); $gdata::useObjectMapping(false); $xmlString = $gdata->getEntry('http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); $this->assertEquals('string', gettype($xmlString)); $gdata::useObjectMapping(true); $entry = $gdata->getEntry('http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); $this->assertTrue($entry instanceof GData\Entry); }
/** * 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 GData\Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } } return parent::getEntry($uri, '\\Zend\\GData\\Books\\VolumeEntry'); }
/** * Retreive a single CommentEntry object. * * @param mixed $location The location for the feed, as a URL or Query. * @return \Zend\GData\Photos\CommentEntry * @throws \Zend\GData\App\Exception * @throws \Zend\GData\App\HttpException */ public function getCommentEntry($location) { if ($location === null) { throw new App\InvalidArgumentException('Location must not be null'); } else { if ($location instanceof UserQuery) { $location->setType('entry'); $uri = $location->getQueryUrl(); } else { if ($location instanceof GData\Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } } } return parent::getEntry($uri, '\\Zend\\GData\\Photos\\CommentEntry'); }
/** * Retrieve a profile entry object * * @param mixed $query The query for the feed, as a URL or Query * @return \Zend\GData\Health\ProfileEntry */ public function getHealthProfileEntry($query = null) { if ($query === null) { throw new GData\App\InvalidArgumentException('Query must not be null'); } else { if ($query instanceof GData\Query) { $uri = $query->getQueryUrl(); } else { $uri = $query; } } return parent::getEntry($uri, '\\Zend\\GData\\Health\\ProfileEntry'); }
/** * Retreive entry object * * @param mixed $location The location for the feed, as a URL or Query * @return \Zend\GData\GBase\ItemEntry */ public function getGBaseItemEntry($location = null) { if ($location === null) { throw new GData\App\InvalidArgumentException('Location must not be null'); } else { if ($location instanceof GData\Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } } return parent::getEntry($uri, '\\Zend\\GData\\GBase\\ItemEntry'); }