コード例 #1
0
ファイル: Client.php プロジェクト: phpro/zf-encoding-com
 /**
  * @param array $options
  * @param array $notifyParams
  *
  * @return EncodingResponse
  */
 public function addMedia($options, $notifyParams = [])
 {
     $baseSettings = ['format' => $this->config->getNotify()->getFormat(), 'notify_format' => $this->config->getNotify()->getFormat(), 'notify' => $this->routeAssembler->buildRoute($this->config->getNotify()->getNotifyRoute(), $notifyParams)];
     $options = array_merge($baseSettings, $options);
     $options['source'] = $this->routeAssembler->buildUrl($options['source']);
     $command = $this->client->getCommand('AddMedia', $options);
     return $this->runCommand($command);
 }
コード例 #2
0
 /**
  * @param       $route
  * @param array $params
  * @param array $options
  *
  * @return string
  */
 public function buildRoute($route, $params = [], $options = [])
 {
     $params['hash'] = $this->config->getHash();
     $options['name'] = $route;
     $options['force_canonical'] = true;
     $options['uri'] = $this->uri;
     return $this->router->assemble($params, $options);
 }
コード例 #3
0
 /**
  * @return JsonModel
  */
 public function notifyAction()
 {
     $this->guardValidHash();
     $format = $this->config->getNotify()->getFormat();
     $rawData = $this->params()->fromPost($format);
     $data = $this->parseData($format, $rawData);
     $this->notifyService->notify($data);
     return new JsonModel(['success' => true]);
 }
コード例 #4
0
 /**
  * @test
  */
 public function it_should_convert_config_to_options()
 {
     $this->assertEquals($this->config->getApi()->getUserId(), 'userid');
     $this->assertEquals($this->config->getApi()->getUserKey(), 'userkey');
     $this->assertEquals($this->config->getNotify()->getFormat(), 'xml');
     $this->assertEquals($this->config->getNotify()->getNotifyRoute(), 'encodingcom/notify');
     $this->assertEquals($this->config->getNotify()->getNotifyService(), 'custom-notify-service-key');
     $this->assertEquals($this->config->getLocalTunnel()->isEnabled(), false);
     $this->assertEquals($this->config->getLocalTunnel()->getHost(), 'subdomain.ngrok.com');
     $this->assertEquals($this->config->getHash(), 'hash');
 }