-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from picqer/specs-downloader
Script to download latest specs
- Loading branch information
Showing
11 changed files
with
163 additions
and
77 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Picqer\BolRetailerV10\OpenApi; | ||
|
||
class SpecsDownloader | ||
{ | ||
private const SPECS = [ | ||
[ | ||
'source' => 'https://api.bol.com/retailer/public/apispec/Retailer%20API%20-%20v10', | ||
'target' => 'retailer.json', | ||
], | ||
[ | ||
'source' => 'https://api.bol.com/retailer/public/apispec/Shared%20API%20-%20v10', | ||
'target' => 'shared.json', | ||
], | ||
]; | ||
|
||
public static function run(): void | ||
{ | ||
foreach (static::SPECS as $spec) { | ||
$sourceFile = file_get_contents($spec['source']); | ||
|
||
// Tidy JSON formatting | ||
$sourceTidied = json_encode(json_decode($sourceFile), JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE); | ||
|
||
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . $spec['target'], $sourceTidied); | ||
} | ||
} | ||
} |
Oops, something went wrong.