-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
155 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Domain\Integrations; | ||
|
||
use Illuminate\Http\Client\PendingRequest; | ||
use Illuminate\Support\Facades\Http; | ||
|
||
// todo: Complete this Class | ||
|
||
/** | ||
* Class SWApi | ||
* @url https://swapi.dev/ | ||
*/ | ||
class SWApi | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public const DEFAULT_TIMEOUT = 100; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
protected int $timeout = self::DEFAULT_TIMEOUT; | ||
|
||
/** | ||
* @return \Illuminate\Http\Client\PendingRequest | ||
*/ | ||
public function makeRequest(): PendingRequest | ||
{ | ||
// todo: Complete this method | ||
return $this->makeRequestBase(); | ||
} | ||
|
||
/** | ||
* @return \Illuminate\Http\Client\PendingRequest | ||
*/ | ||
protected function makeRequestBase(): PendingRequest | ||
{ | ||
return Http::timeout($this->timeout); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace App\Domain\Movies\Jobs; | ||
|
||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Foundation\Bus\Dispatchable; | ||
|
||
// todo: Complete this Class using the SWApi class | ||
class MovieDataFetcherJob implements ShouldQueue | ||
{ | ||
use Dispatchable; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function handle(): void | ||
{ | ||
// todo: implement | ||
} | ||
|
||
protected function updateMovies(?array $externalMoviesData): ?array | ||
{ | ||
// todo: implement | ||
return null; | ||
} | ||
|
||
protected function sendEmailNotificationWithDiff(): void | ||
{ | ||
// todo: implement | ||
// Send email notification with the diff of the movies data | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Exception; | ||
|
||
class MovieDataFetcherController extends Controller | ||
{ | ||
public function post(): void | ||
{ | ||
throw new Exception('Not implemented'); | ||
// MovieDataFetcherJob::dispatch(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters