Add attachments, more pages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
19
app/Services/BookInformation/CachedService.php
Normal file
19
app/Services/BookInformation/CachedService.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\BookInformation;
|
||||
|
||||
use Cache;
|
||||
|
||||
class CachedService implements BookLookupService {
|
||||
private $service;
|
||||
|
||||
public function __construct($service) {
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
public function lookup($isbn) {
|
||||
return Cache::remember('isbn_' . $isbn, 86400, function() use ($isbn) {
|
||||
return $this->service->lookup($isbn);
|
||||
});
|
||||
}
|
||||
}
|
@ -22,9 +22,10 @@ class GoogleBooks implements BookLookupService {
|
||||
*/
|
||||
$volume = Arr::first($results->getItems())->getVolumeInfo();
|
||||
|
||||
return [
|
||||
return (object) [
|
||||
'title' => $volume->getTitle(),
|
||||
'authors' => $volume->getAuthors()
|
||||
'authors' => $volume->getAuthors(),
|
||||
'images' => $volume->getImageLinks(),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user