From a613144ea770ffb7cd4ef3bd0eef5a3bc6720741 Mon Sep 17 00:00:00 2001 From: Chaitanya Surapaneni Date: Wed, 4 Mar 2015 15:53:14 -0600 Subject: [PATCH 1/2] Updating to v2 --- composer.json | 2 +- lib/Kickbox/Api/Kickbox.php | 8 +++++--- lib/Kickbox/HttpClient/HttpClient.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index c3af8bd..f6f8d63 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "kickbox/kickbox", - "version": "1.0.4", + "version": "2.0.0", "description": "Official kickbox API library client for PHP", "homepage": "http://kickbox.io", "authors": [ diff --git a/lib/Kickbox/Api/Kickbox.php b/lib/Kickbox/Api/Kickbox.php index c938fc6..fae913b 100644 --- a/lib/Kickbox/Api/Kickbox.php +++ b/lib/Kickbox/Api/Kickbox.php @@ -5,7 +5,7 @@ use Kickbox\HttpClient\HttpClient; /** - * + * */ class Kickbox { @@ -20,7 +20,7 @@ public function __construct(HttpClient $client) /** * Email Verification * - * '/verify?email=:email' GET + * '/verify?email=:email&timeout=:timeout' GET * * @param $email Email address to verify */ @@ -28,7 +28,9 @@ public function verify($email, array $options = array()) { $body = (isset($options['query']) ? $options['query'] : array()); - $response = $this->client->get('/verify?email='.rawurlencode($email).'', $body, $options); + $timeout = (isset($options['timeout']) ? $options['timeout'] : 6000); + + $response = $this->client->get('/verify?email='.rawurlencode($email).'&timeout='.$timeout.'', $body, $options); return $response; } diff --git a/lib/Kickbox/HttpClient/HttpClient.php b/lib/Kickbox/HttpClient/HttpClient.php index 28321be..bcf1334 100644 --- a/lib/Kickbox/HttpClient/HttpClient.php +++ b/lib/Kickbox/HttpClient/HttpClient.php @@ -19,8 +19,8 @@ class HttpClient { protected $options = array( 'base' => 'https://api.kickbox.io', - 'api_version' => 'v1', - 'user_agent' => 'alpaca/0.2.1 (https://github.com/pksunkara/alpaca)' + 'api_version' => 'v2', + 'user_agent' => 'kickbox-php/2.0.0 (https://github.com/kickboxio/kickbox-php)' ); protected $headers = array(); From e0ef586b88e7b013b9ee27318b5e2aa57d9bee42 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Mon, 16 Mar 2015 11:36:57 -0500 Subject: [PATCH 2/2] Added timeout to docs --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2d4351b..692ebfe 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,14 @@ catch (Exception $e) { echo "Code: " . $e->getCode() . " Message: " . $e->getMessage(); } ``` +#### Options + +**timeout** `integer` (optional) - Maximum time, in milliseconds, for the API to complete a verification request. Default: 6000. + +```php +// Example with options +$response = $kickbox->verify("test@example.com", array('timeout' => 6000)); +``` ### Response information