Skip to content

Commit 2ec1837

Browse files
committed
Merge pull request #42 from vatps/master
Add ApiKey Validation
2 parents 0e8773a + cded850 commit 2ec1837

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/Drewm/MailChimp.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ public function __construct($api_key)
3131
list(, $datacentre) = explode('-', $this->api_key);
3232
$this->api_endpoint = str_replace('<dc>', $datacentre, $this->api_endpoint);
3333
}
34+
35+
/**
36+
* Validates MailChimp API Key
37+
*/
38+
public function validateApiKey()
39+
{
40+
$request = $this->call('helper/ping');
41+
return !empty($request);
42+
}
3443

3544
/**
3645
* Call an API method. Every request needs the API key, so that is added automatically -- you don't need to pass it in.

0 commit comments

Comments
 (0)