public function Send(SoundTouchCommand $command) { $command->preparePayload(); $httpClient = new \GuzzleHttp\Client(array('base_uri' => 'http://' . $this->target['ip'] . ':8090/')); try { if ($command->getMethod() == "POST") { $httpResponse = $httpClient->post($command->getPath(), array('body' => $command->getPayload()), $this->options); } else { // use GET request $httpResponse = $httpClient->get($command->getPath(), $this->options); } $response = $command->createResponse($httpResponse->getBody()->getContents()); } catch (Exception $e) { $response = new SoundTouchResponse(""); } return $response; }
public function __construct() { parent::__construct('GET', 'sources'); }
public function __construct() { parent::__construct('POST', 'name'); }
public function __construct() { parent::__construct('POST', 'bass'); }
public function __construct() { parent::__construct('POST', 'select'); }
public function __construct() { parent::__construct('GET', 'now_playing'); }
public function __construct() { parent::__construct('POST', 'removeZoneSlave'); }
public function __construct() { parent::__construct('GET', 'volume'); }
public function __construct() { parent::__construct('GET', 'getZone'); }
public function __construct() { parent::__construct('GET', 'bassCapabilities'); }
public function __construct() { parent::__construct('POST', 'setZone'); }
public function __construct() { parent::__construct('GET', 'presets'); }
public function __construct() { parent::__construct('GET', 'info'); }