/** * Single drop restful api */ public function action_index() { $this->template = ""; if (!$this->admin) { throw new HTTP_Exception_403(); } switch ($this->request->method()) { case "POST": // Get the POST data $drops = json_decode($this->request->body(), TRUE); Kohana::$log->add(Log::DEBUG, ":count Drops received", array(':count' => count($drops))); Model_Droplet::create_from_array($drops); break; } }
/** * Create a single new drop and publish new ones for meta extraction. * * @return array */ public static function create_drop($drop) { list($drops, $new_drops) = Model_Droplet::create_from_array(array($drop)); if (!empty($new_drops)) { Swiftriver_Event::run('swiftriver.droplet.extract_metadata', $new_drops[0]); Model_Droplet::create_from_array(array($new_drops[0])); } return $drops[0]; }