예제 #1
0
 public function getMessageObject($messageText)
 {
     $message = new \GorkaLaucirica\HipchatAPIv2Client\Model\Message();
     $message->setMessage($messageText);
     if ($this->color == null) {
         $message->setColor($this->channel['hipchattextcolor']);
     } else {
         $message->setColor($this->color);
         $this->color = null;
     }
     $message->setMessageFormat("html");
     return $message;
 }
예제 #2
0
function sendRoomNotification($room, $msg)
{
    LogMe("Sending message to room {$room}: {$msg}");
    $auth = new GorkaLaucirica\HipchatAPIv2Client\Auth\OAuth2(getAuth($room));
    $browserclient = new Buzz\Client\Curl();
    $browserclient->setVerifyPeer(false);
    $browser = new Buzz\Browser($browserclient);
    $client = new GorkaLaucirica\HipchatAPIv2Client\Client($auth, $browser);
    $message = new \GorkaLaucirica\HipchatAPIv2Client\Model\Message();
    $message->setMessage($msg['msg']);
    $message->setMessageFormat('text');
    if (isset($msg['color'])) {
        $message->setColor($msg['color']);
    }
    $x = new GorkaLaucirica\HipchatAPIv2Client\API\RoomAPI($client);
    $ret = $x->sendRoomNotification($room, $message);
    LogMe(print_r($ret, true));
}