View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Service_Longurl
{zone-data}

{zone-data:proposer-list}
[Philippus Baalman|mailto:philippus@gmail.com]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 19 November 2010: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Service_Longurl is a component that implements the Longurl API, version 2.0.
{zone-data}

{zone-data:references}
* [Longurl API|http://longurl.org/api]
{zone-data}

{zone-data:requirements}
* This component will implement an interface with the Longurl API. "Avoid phishing, malware, and viruses by examining short URLs before visiting them. Find out where links really take you."
{zone-data}

{zone-data:dependencies}
* Zend_Rest_Client
* Zend_Service_Exception
{zone-data}

{zone-data:operation}
The component implements all features in the Longurl API.
{zone-data}

{zone-data:milestones}
* Milestone 1: Implementation - [DONE] - Attached
* Milestone 2: Working prototype checked into the incubator
* Milestone 3: Unit tests exist, work, and are checked into SVN.
* Milestone 4: Initial documentation exists.

{attachments:patterns=.*zip|old=true}

{zone-data}

{zone-data:class-list}
* Zend_Service_Longurl
* Zend_Service_Longurl_Exception
{zone-data}

{zone-data:use-cases}
||UC-01||

Retrieve the list of known URL shortening services in serialized php format.

{code}
$longurlservice = new Zend_Service_Longurl();
$longurlservice->setResponseType('php');
$response = $longurlservice->services();
{code}

||UC-02||

Retrieve the long url, include the HTML title and internet media type of the destination URL in the response in XML format.

{code}
$longurlservice = new Zend_Service_Longurl();
$response = $longurlservice->expandUrl(array('url' => 'http://is.gd/w', 'title' => true, 'content-type' => true, 'format' => 'xml'));
{code}
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Service_Longurl extends Zend_Rest_Client
{
/**
* Response Type
* @var String
*/
protected $_responseType = 'xml';

/**
* Response Format Types
* @var array
*/
protected $_responseTypes = array(
'json',
'php',
'xml'
);

/**
* Uri Component
*
* @var Zend_Uri_Http
*/
protected $_uri;

/**
* Constructor
*
* @param string $returnType
* @return void
*/
public function __construct($responseType = 'xml')
{
}

/**
* set responseType
*
* @param string $responseType
* @throws Zend_Service_Longurl_Exception
* @return Zend_Service_Longurl
*/
public function setResponseType($responseType = 'xml')
{
}

/**
* Retrieve responseType
*
* @return string
*/
public function getResponseType()
{
}

/**
* Get the available services
*
* @param array $params
* @throws Zend_Http_Client_Exception
* @return mixed
*/
public function services(array $params = array())
{
}

/**
* Expand an url
*
* @param array $params
* @throws Zend_Http_Client_Exception
* @return mixed
*/
public function expandUrl(array $params = array())
{
}
}

class Zend_Service_Longurl_Exception extends Zend_Service_Exception
{
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>