Skip to content

Commit

Permalink
Prepare v1.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick Wong committed Dec 13, 2013
1 parent 24dc0b6 commit 6fd2c5b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mollie/mollie-api-php",
"version": "1.0.0",
"version": "1.0.1",
"description": "Mollie API client library for PHP",
"homepage": "https://github.com/mollie/mollie-api-php",
"license": "BSD-2-Clause",
Expand Down
32 changes: 23 additions & 9 deletions src/Mollie/API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Mollie_API_Client
/**
* Version of our client.
*/
const CLIENT_VERSION = "1.0";
const CLIENT_VERSION = "1.0.1";

/**
* Endpoint of the remote API.
Expand Down Expand Up @@ -81,12 +81,24 @@ class Mollie_API_Client
*/
protected $api_key;

/**
* @var array
*/
protected $versionStrings = array();

public function __construct ()
{
$this->payments = new Mollie_API_Resource_Payments($this);
$this->issuers = new Mollie_API_Resource_Issuers($this);
$this->methods = new Mollie_API_Resource_Methods($this);

$curl_version = curl_version();
$this->versionStrings = array(
"Mollie/" . self::CLIENT_VERSION,
"PHP/" . phpversion(),
"cURL/" . $curl_version["version"],
$curl_version["ssl_version"],
);
}

/**
Expand Down Expand Up @@ -119,6 +131,14 @@ public function setApiKey ($api_key)
$this->api_key = $api_key;
}

/**
* @param string $version_string
*/
public function addVersionString ($version_string)
{
$this->versionStrings[] = str_replace(array(" ", "\t", "\n", "\r"), '-', $version_string);
}

/**
* Perform an http call. This method is used by the resource specific classes. Please use the $payments property to
* perform operations on payments.
Expand All @@ -135,7 +155,7 @@ public function setApiKey ($api_key)
*
* @codeCoverageIgnore
*/
public function performHttpCall($http_method, $api_method, $http_body = NULL)
public function performHttpCall ($http_method, $api_method, $http_body = NULL)
{
if (empty($this->api_key))
{
Expand All @@ -150,13 +170,7 @@ public function performHttpCall($http_method, $api_method, $http_body = NULL)
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

$curl_version = curl_version();
$user_agent = join(' ', array(
"Mollie/" . self::CLIENT_VERSION,
"PHP/" . phpversion(),
"cURL/" . $curl_version["version"],
$curl_version["ssl_version"],
));
$user_agent = join(' ', $this->versionStrings);

$request_headers = array(
"Accept: application/json",
Expand Down

0 comments on commit 6fd2c5b

Please sign in to comment.