-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGetContentListCommand.php
More file actions
41 lines (36 loc) · 1020 Bytes
/
GetContentListCommand.php
File metadata and controls
41 lines (36 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* @Author Asim Sarwar
* Description Handle Smithsonian Content List
* ClassName GetContentListCommand
*/
namespace App\CurrikiGo\Smithsonian\Commands\Contents;
use App\CurrikiGo\Smithsonian\Contracts\Command;
use Illuminate\Support\Facades\Http;
class GetContentListCommand implements Command
{
/**
* Smithsonian Institution Open Access API query param
* @var array
*/
private $getParam;
/**
* GetContentListCommand constructor.
* @param array $getParam
* @return array
*/
public function __construct($getParam)
{
$this->getParam = $getParam;
}
/**
* Execute an API request to return Smithsonian content list
* @return json object $response
*/
public function execute()
{
$apiUrl = config('smithsonian.api_base_url') . '/search?api_key='.config('smithsonian.api_key').'&' . http_build_query($this->getParam);
$response = Http::get($apiUrl);
return $response->json();
}
}