Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Both sides previous revision Vorhergehende Überarbeitung | |||
redmine:api [2020/03/27 11:14] webproducer Hinweis: Eigenen Benutzer für API anlagen |
redmine:api [2020/10/21 16:47] (aktuell) webproducer Update class.Redmine.php |
||
---|---|---|---|
Zeile 32: | Zeile 32: | ||
return $result->issue->id; | return $result->issue->id; | ||
} | } | ||
+ | | ||
/** | /** | ||
* @param integer $id | * @param integer $id | ||
- | * @return redmineIssueModel | + | * @return models\redmineIssueModel |
+ | * @throws Exception | ||
*/ | */ | ||
public function getIssue( $id ) | public function getIssue( $id ) | ||
Zeile 50: | Zeile 51: | ||
} | } | ||
- | $issueModel = new redmineIssueModel(); | + | $issueModel = new models\redmineIssueModel(); |
$issueModel->subject = $result->issue->subject; | $issueModel->subject = $result->issue->subject; | ||
$issueModel->description = $result->issue->description; | $issueModel->description = $result->issue->description; | ||
+ | $issueModel->done_ratio = $result->done_ratio; | ||
$issueModel->assigned_to_id = $result->issue->assigned_to->id; | $issueModel->assigned_to_id = $result->issue->assigned_to->id; | ||
$issueModel->priority_id = $result->issue->priority->id; | $issueModel->priority_id = $result->issue->priority->id; | ||
Zeile 60: | Zeile 62: | ||
} | } | ||
+ | /** | ||
+ | * @param redmineIssueModel $issueModel | ||
+ | * @param integer $id | ||
+ | * @return bool | ||
+ | * @throws Exception | ||
+ | */ | ||
public function updateIssue( redmineIssueModel $issueModel, $id ) | public function updateIssue( redmineIssueModel $issueModel, $id ) | ||
{ | { | ||
Zeile 80: | Zeile 88: | ||
} | } | ||
+ | /** | ||
+ | * @param integer $id | ||
+ | * @return bool | ||
+ | * @throws Exception | ||
+ | */ | ||
public function deleteIssue( $id ) | public function deleteIssue( $id ) | ||
{ | { | ||
Zeile 97: | Zeile 110: | ||
/** | /** | ||
+ | * @param $curl | ||
* @return mixed | * @return mixed | ||
+ | * @throws Exception | ||
*/ | */ | ||
private function execute( $curl ) | private function execute( $curl ) | ||
Zeile 105: | Zeile 120: | ||
if( $curl_response === false ) | if( $curl_response === false ) | ||
{ | { | ||
- | $info = curl_getinfo( $curl ); | ||
curl_close( $curl ); | curl_close( $curl ); | ||
- | die( 'error occured during curl exec. Additioanl info: ' . var_export( $info ) ); | + | throw new \Exception( 'Service Unavailable', 503 ); |
} | } | ||
Zeile 113: | Zeile 127: | ||
$decoded = json_decode( $curl_response ); | $decoded = json_decode( $curl_response ); | ||
- | if( isset( $decoded->errors ) ) | + | if( isset( $decoded->error ) ) |
{ | { | ||
- | die( 'error occured: ' . print_r( $decoded->errors, 1 ) ); | + | throw new \Exception( $decoded->error, $decoded->status ); |
} | } | ||