Skip to content

Commit

Permalink
Merge pull request #4 from kickboxio/v2
Browse files Browse the repository at this point in the history
Updating to V2
  • Loading branch information
schaitanya committed Mar 16, 2015
2 parents 48b582f + e0ef586 commit 6856a43
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
8 changes: 5 additions & 3 deletions lib/Kickbox/Api/Kickbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Kickbox\HttpClient\HttpClient;

/**
*
*
*/
class Kickbox
{
Expand All @@ -20,15 +20,17 @@ public function __construct(HttpClient $client)
/**
* Email Verification
*
* '/verify?email=:email' GET
* '/verify?email=:email&timeout=:timeout' GET
*
* @param $email Email address to verify
*/
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;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Kickbox/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6856a43

Please sign in to comment.