From dcbfe010845ef4f0759de84aaf07320c1b499a3e Mon Sep 17 00:00:00 2001 From: Muhamad Hanafiah Yahya Date: Mon, 21 Nov 2016 17:01:38 +0800 Subject: [PATCH 1/5] Bug fixed Invalid variable for the $money. --- src/Three/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Three/Collection.php b/src/Three/Collection.php index 6f778a5..4cf1cf5 100644 --- a/src/Three/Collection.php +++ b/src/Three/Collection.php @@ -43,7 +43,7 @@ public function create($title, array $optional = []) */ public function createOpen($title, $description, $amount, array $optional = []) { - $amount = $money->getAmount(); + $amount = $amount->getAmount(); $body = array_merge(compact('title', 'description', 'amount'), $optional); return $this->send('POST', 'open_collections', [], $body); From a6bc714c4a9aca300dcbea9bf3637ebcd4d9bab8 Mon Sep 17 00:00:00 2001 From: Hakim Razalan Date: Thu, 23 Feb 2017 15:39:18 +0800 Subject: [PATCH 2/5] Add get collection, get collection index, get open collection and get open collection index --- src/Three/Collection.php | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/Three/Collection.php b/src/Three/Collection.php index 24b0738..e3048bc 100644 --- a/src/Three/Collection.php +++ b/src/Three/Collection.php @@ -31,6 +31,30 @@ public function create($title, array $optional = []) return $this->send('POST', 'collections', $headers, $stream); } + /** + * Get collection. + * + * @param string $id + * + * @return \Laravie\Codex\Response + */ + public function get($id) + { + return $this->send('GET', "collections/{$id}", [], []); + } + + /** + * Get collection. + * + * @param string $id + * + * @return \Laravie\Codex\Response + */ + public function index($id, array $optional = []) + { + return $this->send('GET', "collections/{$id}", [], $optional); + } + /** * Create a new open collection. * @@ -48,6 +72,31 @@ public function createOpen($title, $description, $amount, array $optional = []) return $this->send('POST', 'open_collections', [], $body); } + /** + * Get collection. + * + * @param string $id + * + * @return \Laravie\Codex\Response + */ + public function getOpen($id) + { + return $this->send('GET', "open_collections/{$id}", [], []); + } + + /** + * Get collection index. + * + * @param string $id + * @param array $optional + * + * @return \Laravie\Codex\Response + */ + public function indexOpen($id, array $optional = []) + { + return $this->send('GET', "open_collections/{$id}", [], $optional); + } + /** * Activate a collection. * @@ -71,4 +120,6 @@ public function deactivate($id) { return $this->send('POST', "collections/{$id}/deactivate", [], []); } + + } From a7e7530ea1cdf9d550ef562509f0270df4d8dfaa Mon Sep 17 00:00:00 2001 From: Hakim Razalan Date: Thu, 23 Feb 2017 15:42:19 +0800 Subject: [PATCH 3/5] fix comment on open collection get and get index function --- src/Three/Collection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Three/Collection.php b/src/Three/Collection.php index e3048bc..413da5a 100644 --- a/src/Three/Collection.php +++ b/src/Three/Collection.php @@ -73,7 +73,7 @@ public function createOpen($title, $description, $amount, array $optional = []) } /** - * Get collection. + * Get open collection. * * @param string $id * @@ -85,7 +85,7 @@ public function getOpen($id) } /** - * Get collection index. + * Get open collection index. * * @param string $id * @param array $optional From 95cc4efcd9694a8f39153790de685287765eb8ee Mon Sep 17 00:00:00 2001 From: Hakim Razalan Date: Thu, 23 Feb 2017 17:35:06 +0800 Subject: [PATCH 4/5] delete extra unwanted parameters on index function for Collection --- src/Three/Collection.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Three/Collection.php b/src/Three/Collection.php index 413da5a..1d33e7e 100644 --- a/src/Three/Collection.php +++ b/src/Three/Collection.php @@ -44,15 +44,13 @@ public function get($id) } /** - * Get collection. - * - * @param string $id + * Get collection index. * * @return \Laravie\Codex\Response */ - public function index($id, array $optional = []) + public function index(array $optional = []) { - return $this->send('GET', "collections/{$id}", [], $optional); + return $this->send('GET', "collections", [], $optional); } /** @@ -87,14 +85,13 @@ public function getOpen($id) /** * Get open collection index. * - * @param string $id * @param array $optional * * @return \Laravie\Codex\Response */ - public function indexOpen($id, array $optional = []) + public function indexOpen(array $optional = []) { - return $this->send('GET', "open_collections/{$id}", [], $optional); + return $this->send('GET', "open_collections", [], $optional); } /** From 90bf40c923ab0f1e02b1439a0ae81fce756998a1 Mon Sep 17 00:00:00 2001 From: crynobone Date: Fri, 24 Feb 2017 08:23:16 +0800 Subject: [PATCH 5/5] Use vendor phpunit. Signed-off-by: crynobone --- .travis.yml | 4 ++-- src/Three/Collection.php | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a80b44a..971491f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ before_script: - if [[ $setup = 'coveralls' ]]; then travis_retry composer require "satooshi/php-coveralls=~0.7" --prefer-dist --no-interaction --dev; fi script: - - if [[ $coverage = 'yes' ]]; then phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml; fi - - if [[ $coverage = 'no' ]]; then phpunit -c phpunit.xml; fi + - if [[ $coverage = 'yes' ]]; then vendor/bin/phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml; fi + - if [[ $coverage = 'no' ]]; then vendor/bin/phpunit -c phpunit.xml; fi after_script: - if [[ $setup = 'coveralls' ]]; then php vendor/bin/coveralls -v; fi diff --git a/src/Three/Collection.php b/src/Three/Collection.php index 1d33e7e..36133b2 100644 --- a/src/Three/Collection.php +++ b/src/Three/Collection.php @@ -117,6 +117,4 @@ public function deactivate($id) { return $this->send('POST', "collections/{$id}/deactivate", [], []); } - - }