fix status
This commit is contained in:
parent
9ffc956e81
commit
8d33a26168
@ -26,19 +26,21 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
|||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
|
||||||
switch ($response->stat) {
|
if ($response) {
|
||||||
case 'ok':
|
switch ($response->stat) {
|
||||||
|
case 'ok':
|
||||||
|
|
||||||
foreach ($response->alert_contacts as $alert_contact) {
|
foreach ($response->alert_contacts as $alert_contact) {
|
||||||
|
|
||||||
$alertContact = AlertContact::getAlertContactFromResponse($alert_contact);
|
$alertContact = AlertContact::getAlertContactFromResponse($alert_contact);
|
||||||
|
|
||||||
$this->cachedAlertContacts[] = $alertContact;
|
$this->cachedAlertContacts[] = $alertContact;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,17 +68,18 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
if ($response) {
|
||||||
switch ($response->stat) {
|
switch ($response->stat) {
|
||||||
case 'ok':
|
case 'ok':
|
||||||
$alertContact->setId($response->alertcontact->id);
|
$alertContact->setId($response->alertcontact->id);
|
||||||
return $alertContact;
|
return $alertContact;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,14 +105,16 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
|||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
|
||||||
switch ($response->stat) {
|
if ($response) {
|
||||||
case 'ok':
|
switch ($response->stat) {
|
||||||
$alertContact->setId($response->alert_contact->id);
|
case 'ok':
|
||||||
return $alertContact;
|
$alertContact->setId($response->alert_contact->id);
|
||||||
break;
|
return $alertContact;
|
||||||
default:
|
break;
|
||||||
return false;
|
default:
|
||||||
break;
|
return null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,15 +133,17 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
if ($response) {
|
||||||
switch ($response->stat) {
|
switch ($response->stat) {
|
||||||
case 'ok':
|
case 'ok':
|
||||||
return $alertContact;
|
return $alertContact;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return null;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,7 +159,7 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
|||||||
|
|
||||||
/** @var AlertContact $alertContact */
|
/** @var AlertContact $alertContact */
|
||||||
foreach ($this->cachedAlertContacts as $alertContact) {
|
foreach ($this->cachedAlertContacts as $alertContact) {
|
||||||
if ($alertContact->getId() === $id || $alertContact->getFriendlyName() === $name || $alertContact->getValue() === $value ) {
|
if ($alertContact->getId() === $id || $alertContact->getFriendlyName() === $name || $alertContact->getValue() === $value) {
|
||||||
return $alertContact;
|
return $alertContact;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
|||||||
'status' => $monitor->getStatus()
|
'status' => $monitor->getStatus()
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!empty($alertContactsString)){
|
if (!empty($alertContactsString)) {
|
||||||
$params['alert_contacts'] = $alertContactsString;
|
$params['alert_contacts'] = $alertContactsString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,15 +156,16 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
if ($response) {
|
||||||
switch ($response->stat) {
|
switch ($response->stat) {
|
||||||
case 'ok':
|
case 'ok':
|
||||||
$monitor->setId($response->monitor->id);
|
$monitor->setId($response->monitor->id);
|
||||||
return $monitor;
|
return $monitor;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,15 +184,17 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
if ($response) {
|
||||||
switch ($response->stat) {
|
switch ($response->stat) {
|
||||||
case 'ok':
|
case 'ok':
|
||||||
return $monitor;
|
return $monitor;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,15 +212,17 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode($jsonResponse);
|
$response = json_decode($jsonResponse);
|
||||||
|
if ($response) {
|
||||||
switch ($response->stat) {
|
switch ($response->stat) {
|
||||||
case 'ok':
|
case 'ok':
|
||||||
return $monitor;
|
return $monitor;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user