Skip to content

Commit

Permalink
Merge pull request #5 from bookboon/feature/examByBookId
Browse files Browse the repository at this point in the history
Added get exams by bookId
  • Loading branch information
lkm authored Jan 31, 2017
2 parents fa0c258 + 310e364 commit ee37f4c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Entity/Exam.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ public static function get(Bookboon $bookboon, $examId)
return new static($bookboon->rawRequest("/exams/$examId"));
}

public static function getByBookId(Bookboon $bookboon, $bookId)
{
if (Entity::isValidUUID($bookId) === false) {
throw new BadUUIDException("UUID Not Formatted Correctly");
}

$exams = $bookboon->rawRequest("/books/$bookId/exams");

return Exam::getEntitiesFromArray($exams);
}

public static function start(Bookboon $bookboon, $examId)
{
return $bookboon->rawRequest("/exams/$examId", [], Client::HTTP_POST);
Expand Down

0 comments on commit ee37f4c

Please sign in to comment.