public function delete($project_id, $object_id) { $snoopy = new Snoopy(); $snoopy->accept = 'application/json'; $url = AcHelper::makeApiUrl($this->acBaseURL . '/projects/' . $project_id . '/objects/' . $object_id . '/move-to-trash', $this->userAPIKey); $postParams = array('submitted' => 'submitted'); return AcHelper::sendPostRequest($url, $postParams, 'json'); }
public function complete($acBaseUrl = null, $userAPIKey = null) { $baseUrl = $this->acBaseUrl; if ($acBaseUrl != null && is_string($acBaseUrl) && $acBaseUrl != "") { $baseUrl = $acBaseUrl; } $apiKey = $this->userApiKey; if ($userApiKey != null && is_string($userApiKey) && $userApiKey != "") { $apiKey = $userApiKey; } $rawObject = AcHelper::sendPostRequest('/projects/' . $this->project_id . '/objects/' . $this->object_id . '/complete', array('submitted' => 'submitted'), $baseUrl, $apiKey); $this->populate($rawObject); }
public function load($project_id, $ticket_id) { $snoopy = new Snoopy(); $snoopy->accept = 'application/json'; $url = AcHelper::makeApiUrl($this->acBaseURL . '/projects/' . $project_id . '/tickets/' . $ticket_id, $this->userAPIKey); $snoopy->fetch($url); // on failure, throw an exception if ($snoopy->status != 200) { throw new HttpException($snoopy->results, $snoopy->status); } $rawTicket = json_decode($snoopy->results); echo '<pre>', var_dump($rawTicket), '</pre>'; $acTicket = new AcTicket($rawTicket); return $acTicket; }
public function save($acBaseUrl = null, $userApiKey = null) { $tagsComma = ""; for ($i = 0; $i < count($this->tags); ++$i) { $tagsComma .= $i != 0 ? ', ' : ''; $tagsComma .= $this->tags[$i]; } $post_params = AcTicket::createTicketPostArray($this->name, $this->body, $tagsComma, $this->visibility, $this->priority, $this->due_on, $this->assignees, $this->milestone_id, $this->parrent_id); $baseUrl = $this->acBaseUrl; if ($acBaseUrl != null && is_string($acBaseUrl) && $acBaseUrl != "") { $baseUrl = $acBaseUrl; } $apiKey = $this->userApiKey; if ($userApiKey != null && is_string($userApiKey) && $userApiKey != "") { $apiKey = $userApiKey; } $rawTicket = AcHelper::sendPostRequest('/projects/' . $this->project_id . '/tickets/' . $this->ticket_id . '/edit', $post_params, $baseUrl, $apiKey); $this->populate($rawTicket); echo '<h2>Save</h2>'; echo '<pre>'; //var_dump($post_params); //var_dump($rawTicket); var_dump($this); echo '</pre>'; }