Tweak Sending Service key validation after a code review [MAILPOET-743]

* Abstract key state to unbound it from the API response codes
* Rename SendingServiceKeyCheck task for clarity
* Add a setter for the API key in the Bridge API class
* Make some smaller fixes
This commit is contained in:
Alexey Stoletniy
2017-01-23 23:40:20 +03:00
parent 425d45a862
commit 98d6f55a6e
13 changed files with 123 additions and 83 deletions

View File

@ -8,7 +8,7 @@ class API {
public $api_key;
function __construct($api_key) {
$this->api_key = $api_key;
$this->setKey($api_key);
}
function checkKey() {
@ -19,6 +19,10 @@ class API {
return $this->processResponse($result);
}
function setKey($api_key) {
$this->api_key = $api_key;
}
private function processResponse($result) {
$code = wp_remote_retrieve_response_code($result);
switch($code) {