Example #1
0
 function testGetUrl()
 {
     $rule_types = array(new Services_Gnip_Rule_Type('actor'));
     $publisher = new Services_Gnip_Publisher('name', $rule_types);
     $expected_url = '/publishers/' . $publisher->name . ".xml";
     $this->assertEquals($expected_url, $publisher->getUrl());
 }
Example #2
0
 /**
  * Retrieves a single publisher by name. 
  * 
  * @param string $publisherName name of an existing publisher
  * @param string $scope publisher scope (my or gnip) default is gnip
  * @return object $publisher Services_Gnip_Publisher
  */
 function getPublisher($publisherName, $scope = "gnip")
 {
     $scope = $this->_scopeprep($scope);
     $publisher = new Services_Gnip_Publisher($publisherName);
     try {
         $xml = $this->helper->doHttpGet($scope . $publisher->getUrl());
         return $publisher->fromXML($xml);
     } catch (Exception $e) {
         $message = "There was a problem when calling getPublisher on {$publisherName}. Status message: ";
         $this->_handleDebug($message, $this->debug, $e);
     }
 }
Example #3
0
 /**
  * Returns XML data for requested XML publisher.
  *
  * @access    public
  * @param     string        $publisher_name    Requested Gnip publisher name
  * @return    XMLElement                       Requested publisher XML data
  */
 function getPublisher($name)
 {
     $publisher = new Services_Gnip_Publisher($name);
     $xml = $this->helper->doHttpGet($publisher->getUrl() . ".xml");
     return Services_Gnip_Publisher::fromXML(new SimpleXMLElement($xml));
 }