Пример #1
0
 /**
  * send request to specified host
  *
  * @param string $method
  * @param $url
  * @param array $data
  * @param bool $return_as_json
  * @return mixed
  */
 public function api($method = self::REQUEST_GET, $url, $data = array(), $return_as_json = false, $isfile = false, $debug = FALSE)
 {
     $result = $this->client->sendRequest($method, $url, $data, $this->getEndpoint(), $this->authentication, $isfile, $debug);
     if (strlen($result)) {
         $json = json_decode($result, true);
         if ($this->options & self::AUTOMAP_FIELDS) {
             if (isset($json['issues'])) {
                 if (!count($this->fields)) {
                     $this->getFields();
                 }
                 foreach ($json['issues'] as $offset => $issue) {
                     $json['issues'][$offset] = $this->automapFields($issue);
                 }
             }
         }
         if ($return_as_json) {
             return $json;
         } else {
             return new Jira_Api_Result($json);
         }
     } else {
         return false;
     }
 }
Пример #2
0
 public function downloadAttachment($url)
 {
     $result = $this->client->sendRequest(self::REQUEST_GET, $url, array(), null, $this->authentication, true, false);
     return $result;
 }