     1: <?php
     2: /**
     3:  * Copyright 2012-2014 Rackspace US, Inc.
     4:  *
     5:  * Licensed under the Apache License, Version 2.0 (the "License");
     6:  * you may not use this file except in compliance with the License.
     7:  * You may obtain a copy of the License at
     8:  *
     9:  * http://www.apache.org/licenses/LICENSE-2.0
    10:  *
    11:  * Unless required by applicable law or agreed to in writing, software
    12:  * distributed under the License is distributed on an "AS IS" BASIS,
    13:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14:  * See the License for the specific language governing permissions and
    15:  * limitations under the License.
    16:  */
    17:
    18: namespace OpenCloud\CloudMonitoring\Resource;
    19:
    20: use OpenCloud\Common\Http\Message\Formatter;
    21:
    22: /**
    23:  * NotificationHistory class.
    24:  */
    25: class NotificationHistory extends ReadOnlyResource
    26: {
    27:     private $id;
    28:     private $timestamp;
    29:     private $notification_plan_id;
    30:     private $transaction_id;
    31:     private $status;
    32:     private $state;
    33:     private $notification_results;
    34:     private $previous_state;
    35:
    36:     protected static $json_name = false;
    37:     protected static $json_collection_name = 'values';
    38:     protected static $url_resource = 'notification_history';
    39:
    40:     public function listChecks()
    41:     {
    42:         $response = $this->getClient()->get($this->url())->send();
    43:
    44:         return Formatter::decode($response);
    45:     }
    46:
    47:     public function listHistory($checkId)
    48:     {
    49:         return $this->getService()->collection(get_class(), $this->url($checkId));
    50:     }
    51:
    52:     public function getSingleHistoryItem($checkId, $historyId)
    53:     {
    54:         $url = $this->url($checkId . '/' . $historyId);
    55:         $response = $this->getClient()->get($url)->send();
    56:
    57:         if (null !== ($decoded = Formatter::decode($response))) {
    58:             $this->populate($decoded);
    59:         }
    60:
    61:         return false;
    62:     }
    63: }
    64: