From 898f03fd92fe24552b78739b3545d1ccae358848 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Mon, 24 Jun 2019 20:28:21 -0300 Subject: [PATCH] Project: Included a getProject API call --- src/FetchApi.php | 2 +- src/Project.php | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/FetchApi.php b/src/FetchApi.php index 14f827b..99e4fb9 100644 --- a/src/FetchApi.php +++ b/src/FetchApi.php @@ -34,7 +34,7 @@ class FetchApi * * @return void */ - public function fetch(string $method, string $url, array $parameters, $filename = '') : string + public function fetch(string $method, string $url, array $parameters = [], $filename = '') : string { $setopt = []; switch ($method) { diff --git a/src/Project.php b/src/Project.php index fc4a478..bd7da52 100644 --- a/src/Project.php +++ b/src/Project.php @@ -1,25 +1,38 @@ * @link https://github.com/brunofontes */ + namespace BrunoFontes\Memsource; class Project extends \BrunoFontes\Memsource\BaseApi { private $_url = '/api2/v1/projects'; - + /** * List projects * * @param string $queryParams An array with the Query parameters to filter projects - * + * * @return string The JSON answer from Memsource */ public function listProjects(array $queryParams = []): string { return $this->fetchApi->fetch('get', $this->_url, $queryParams); } + + /** + * Return details about a single project + * + * @param string $projectUid The project UID + * + * @return string A json string with all project info + */ + public function getProject(string $projectUid): string + { + return $this->fetchApi->fetch('get', "{$this->_url}/{$projectUid}"); + } }