Skip to content

Commit

Permalink
Merge pull request #39 from bookboon/feature/getAllAuthors
Browse files Browse the repository at this point in the history
Author::getAll, allowing for all published authors to be parsed
  • Loading branch information
lkm authored Apr 17, 2019
2 parents e8a5c38 + 49589ec commit dc386b9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Client/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ private function getRemoteAddress() : ?string

if (isset($_SERVER['REMOTE_ADDR'])) {
$hostname = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);

if (false === $hostname) {
$hostname = null;
}
}

if (function_exists('apache_request_headers')) {
Expand All @@ -99,4 +103,4 @@ private function getRemoteAddress() : ?string

return $hostname;
}
}
}
17 changes: 17 additions & 0 deletions src/Entity/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ public static function get(Bookboon $bookboon, string $authorId) : BookboonRespo
return $bResponse;
}

/**
* @param Bookboon $bookboon
* @return BookboonResponse
* @throws \Bookboon\Api\Exception\ApiDecodeException
* @throws \Bookboon\Api\Exception\UsageException
*/
public static function getAll(Bookboon $bookboon)
{
$bResponse = $bookboon->rawRequest("/authors");

$bResponse->setEntityStore(
new EntityStore(static::getEntitiesFromArray($bResponse->getReturnArray()))
);

return $bResponse;
}

/**
* Get Author by book.
*
Expand Down

0 comments on commit dc386b9

Please sign in to comment.