Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions Services/Zencoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ class Services_Zencoder extends Services_Zencoder_Base
* @param string $api_version API version
* @param string $api_host API host
* @param bool $debug Enable debug mode
* @param string $ca_path Path to a directory that holds multiple CA certificates
* @param string $ca_file Path to a file holding one or more certificates to verify the peer with
*/
public function __construct(
$api_key = NULL,
$api_version = 'v2',
$api_host = 'https://app.zencoder.com',
$debug = false
$debug = false,
$ca_path = NULL,
$ca_file = NULL
)
{
// Check that library dependencies are met
Expand All @@ -114,13 +118,18 @@ public function __construct(
if (!function_exists('curl_init')) {
throw new Services_Zencoder_Exception('cURL extension must be enabled.');
}

$this->version = $api_version;
$this->http = new Services_Zencoder_Http(
$api_host,
array("curlopts" => array(
CURLOPT_USERAGENT => self::USER_AGENT
), "api_key" => $api_key, "debug" => $debug)
);

$http_options = array("api_version" => $api_key, "debug" => $debug, "curlopts" => array(CURLOPT_USERAGENT => self::USER_AGENT));
if (isset($ca_path)) {
$http_options["curlopts"][CURLOPT_CAPATH] = realpath($ca_path);
}
if (isset($ca_file)) {
$http_options["curlopts"][CURLOPT_CAINFO] = realpath($ca_file);
}

$this->http = new Services_Zencoder_Http($api_host, $http_options);
$this->accounts = new Services_Zencoder_Accounts($this);
$this->inputs = new Services_Zencoder_Inputs($this);
$this->jobs = new Services_Zencoder_Jobs($this);
Expand Down