Example #1
0
 function testGetCreateUrl()
 {
     $rule_types = array(new Services_Gnip_Rule_Type('actor'));
     $publisher = new Services_Gnip_Publisher('name', $rule_types);
     $expected_url = '/publishers';
     $this->assertEquals($expected_url, $publisher->getCreateUrl());
 }
Example #2
0
 /**
  * Returns array of all publisher names
  *
  * @access    public
  * @return    array     all publisher names
  */
 function getPublishers()
 {
     $xml = $this->helper->doHttpGet(Services_Gnip_Publisher::getIndexUrl());
     $xml = new SimpleXMLElement($xml);
     $publishers = array();
     foreach ($xml->children() as $child) {
         $publishers[] = Services_Gnip_Publisher::fromXML($child);
     }
     return $publishers;
 }
Example #3
0
 /**
  * Create new Gnip Publisher -- with XML value -- then validate against returned string value.
  *
  * @access    public
  * @param     void
  * @return    void
  */
 function testFromXml()
 {
     $publisher = Services_Gnip_Publisher::fromXML(new SimpleXMLElement("<publisher name='bob'/>"));
     $this->assertEquals("bob", $publisher->name);
 }
Example #4
0
 /**
  * Retrieves all publishers from the Gnip servers. 
  * 
  * @param string $scope publisher scope (my or gnip) default is gnip
  * @return array containing Services_Gnip_Publisher objects
  */
 function getAllPublishers($scope = "gnip")
 {
     $scope = $this->_scopeprep($scope);
     try {
         $xml = $this->helper->doHttpGet($scope . Services_Gnip_Publisher::getIndexUrl());
         $xml = new SimpleXMLElement($xml);
         $publishers = array();
         foreach ($xml->children() as $child) {
             $publishers[] = Services_Gnip_Publisher::fromXML($child->asXML());
         }
         return $publishers;
     } catch (Exception $e) {
         $message = "There was a problem when calling getAllPublishers(). Status message: ";
         $this->_handleDebug($message, $this->debug, $e);
     }
 }