diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf28284..3f74dcf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [5.2.2] - 2017-01-24 +### Fixed: + - Search method correctly works with limits. + ## [5.2.1] - 2017-01-22 ### Fixed: - Pinners *followers()* methods. diff --git a/src/Api/SearchResponse.php b/src/Api/SearchResponse.php index a4ed6049..22e88ec3 100644 --- a/src/Api/SearchResponse.php +++ b/src/Api/SearchResponse.php @@ -6,7 +6,13 @@ class SearchResponse extends Response { protected function getRawBookmarksData() { - return $this->getData('module.tree.resource.options.bookmarks', []); + // First response is special and returns bookmarks in 'module.tree` array + $bookmarks = $this->getData('module.tree.resource.options.bookmarks', []); + + // All the next responses look as expected + return empty($bookmarks) ? + parent::getRawBookmarksData() : + $bookmarks; } /** @@ -15,6 +21,12 @@ protected function getRawBookmarksData() */ public function getResponseData($key = null) { - return $this->getData('module.tree.data.results', []); + // First response is special and returns data in 'module.tree` array + $data = $this->getData('module.tree.data.results', []); + + // All the next responses look as expected + return empty($data) ? + parent::getResponseData() : + $data; } } \ No newline at end of file