/** * @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); }
/** * Create new EncodingClient Instance * * @param array|Collection $config * Configuration data. Array keys: * * base_url - http(s)://manage.encoding.com * userid - API User Id * userkey - API Key * * @return EncodingClient */ public static function factory($config = array()) { $config = self::getConfigCollection($config); $client = new EncodingClient($config->get('base_url'), $config->get('userid'), $config->get('userkey')); $client->setConfig($config); // Add the XML service description to the client $description = ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'guzzle_encoding_com.json'); $client->setDescription($description); return $client; }
/** * {@inheritdoc} */ public function createService(ServiceLocatorInterface $serviceLocator) { $routeAssembler = $serviceLocator->get('Phpro\\EncodingCom\\Service\\RouteAssembler'); $config = $serviceLocator->get('Phpro\\EncodingCom\\Options\\EncodingCom'); $apiConfig = $config->getApi(); $encodingClient = EncodingClient::factory(['userid' => $apiConfig->getUserId(), 'userkey' => $apiConfig->getUserKey()]); return new Client($encodingClient, $config, $routeAssembler); }
public function testMissingParamsException() { $this->setExpectedException("InvalidArgumentException"); $object = EncodingClient::factory(); }
/** * @param $type * @param $options */ protected function mockCommand($type, $options) { $command = $this->getMock('Guzzle\\Service\\Command\\CommandInterface'); $command->expects($this->any())->method('getResult')->will($this->returnValue(['result' => true])); $this->encodingClient->expects($this->any())->method('getCommand')->with('AddMedia', $options)->will($this->returnValue($command)); }