/** * @return array associative array response * @param array $args array('time' => , 'type' => , 'data' => ) */ public function eventPut($args) { $args = \Cube\Command::prepPayload($args); $req = \Httpful\Request::post($this->collector_uri . '1.0/event/put')->sendsJson()->expectsJson()->body($args); $res = $req->send(); if (array_key_exists('error', $res->body)) { // optionally log error? maybe throw exception? return false; } return true; }
public function testCommand() { $cmds = array('eventGet', 'metricGet', 'typesGet', 'eventPut'); $this->assertEquals($cmds, \Cube\Command::getCommands()); }