-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGetContentDetailCommand.php
More file actions
40 lines (36 loc) · 1016 Bytes
/
GetContentDetailCommand.php
File metadata and controls
40 lines (36 loc) · 1016 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
<?php
/**
* @Author Asim Sarwar
* Description Handle Smithsonian Content Detail
* ClassName GetContentDetailCommand
*/
namespace App\CurrikiGo\Smithsonian\Commands\Contents;
use App\CurrikiGo\Smithsonian\Contracts\Command;
use Illuminate\Support\Facades\Http;
class GetContentDetailCommand implements Command
{
/**
* Smithsonian Institution Open Access API query param
* @var array
*/
private $getParam;
/**
* GetContentDetailCommand constructor.
* @param array $getParam
* @return array
*/
public function __construct($getParam)
{
$this->getParam = $getParam;
}
/**
* Execute an API request to return Smithsonian content detail
* @return json object $response
*/
public function execute()
{
$apiUrl = config('smithsonian.api_base_url') . '/content/'.$this->getParam['id'].'?api_key='.config('smithsonian.api_key');
$response = Http::get($apiUrl);
return $response->json();
}
}