Refactor SoundCloud/Third party controllers to fit new service architecture
This commit is contained in:
parent
5bd8a508b1
commit
79db208cd4
|
@ -23,6 +23,45 @@ class SoundcloudController extends ThirdPartyController implements OAuth2Control
|
|||
$this->_service = new Application_Service_SoundcloudService();
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the file with the given id to a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function uploadAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->upload($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the file with the given id from a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if download fails for any reason
|
||||
*/
|
||||
public function downloadAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->download($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the file with the given id from a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if deletion fails for any reason
|
||||
*/
|
||||
public function deleteAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send user to SoundCloud to authorize before being redirected
|
||||
*
|
||||
|
|
|
@ -24,50 +24,10 @@ abstract class ThirdPartyController extends Zend_Controller_Action {
|
|||
* Disable controller rendering and initialize
|
||||
*/
|
||||
public function init() {
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$this->_baseUrl = 'http://' . $CC_CONFIG['baseUrl'] . ":" . $CC_CONFIG['basePort'] . "/";
|
||||
$this->_baseUrl = Application_Common_HTTPHelper::getStationUrl();
|
||||
|
||||
$this->view->layout()->disableLayout(); // Don't inject the standard Now Playing header.
|
||||
$this->_helper->viewRenderer->setNoRender(true); // Don't use (phtml) templates
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the file with the given id to a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function uploadAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->upload($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the file with the given id from a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if download fails for any reason
|
||||
*/
|
||||
public function downloadAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->download($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the file with the given id from a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if deletion fails for any reason
|
||||
*/
|
||||
public function deleteAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->delete($id);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue