Skip to content

Commit 24246a9

Browse files
authored
Merge pull request #138 from synga-nl/patch-1
Implemented version create method
2 parents 0680a31 + 867700b commit 24246a9

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/Version/VersionService.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,26 @@ class VersionService extends \JiraRestApi\JiraClient
1111
private $uri = '/version';
1212

1313
/**
14-
* create version.
14+
* Function to create a new project version.
1515
*
16-
* @see https://docs.atlassian.com/jira/REST/server/#api/2/version-createVersion
16+
* @param Version|array $version
17+
*
18+
* @throws \JiraRestApi\JiraException
19+
* @throws \JsonMapper_Exception
20+
*
21+
* @return Version|object Version class
1722
*/
1823
public function create($version)
1924
{
20-
throw new JiraException('create version not yet implemented');
25+
$data = json_encode($version);
26+
27+
$this->log->addInfo("Create Version=\n".$data);
28+
29+
$ret = $this->exec($this->uri, $data, 'POST');
30+
31+
return $this->json_mapper->map(
32+
json_decode($ret), new Version()
33+
);
2134
}
2235

2336
/**

0 commit comments

Comments
 (0)