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:
@ -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) {
|
||||
|
Reference in New Issue
Block a user