public function send(MessageInterface $message)
{
// Validate we have everything we need
foreach (array('token', 'room', 'from') as $variable) {
if (empty($this->{$variable})) {
throw new InvalidArgumentException("Invalid `{$variable}`");
}
}
// Build up the data we are sending to Hipchat
$data = array('room_id' => $this->getRoom(), 'from' => $this->getFrom(), 'message' => $message->getMessage(), 'message_format' => $message->getMessageFormat(), 'notify' => $message->getNotification(), 'color' => $message->getBackgroundColor(), 'format' => 'json');
$data = http_build_query($data, '', '&');
return $this->http->post($this->getUri(), $this->getHeaders(), $data)->send();
}