-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
10f11de
commit 2e07266
Showing
17 changed files
with
151 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace GOAPI\IO\Exceptions; | ||
use GuzzleHttp\Exception\GuzzleException; | ||
|
||
class RequestException extends GuzzleException { | ||
|
||
} |
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,17 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources\Region; | ||
|
||
class Region { | ||
|
||
/** | ||
* Constructor for the class. | ||
* | ||
* @param mixed $code The code parameter. | ||
* @param mixed $name The name parameter. | ||
*/ | ||
function __construct(public $id, public $name) | ||
{ | ||
|
||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GoAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
class Broker { | ||
public $code; | ||
|
2 changes: 1 addition & 1 deletion
2
src/Resources/BrokerSummary.php → src/Resources/Stock/BrokerSummary.php
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
class BrokerSummary | ||
{ | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
src/Resources/CompanyProfile.php → src/Resources/Stock/CompanyProfile.php
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
class CompanyProfile { | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
src/Resources/StockIndex.php → src/Resources/Stock/StockIndex.php
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
|
||
class StockIndex { | ||
|
2 changes: 1 addition & 1 deletion
2
src/Resources/StockIndicator.php → src/Resources/Stock/StockIndicator.php
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
class StockIndicator { | ||
/** | ||
|
2 changes: 1 addition & 1 deletion
2
src/Resources/StockPrice.php → src/Resources/Stock/StockPrice.php
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
src/Resources/StockPriceChange.php → src/Resources/Stock/StockPriceChange.php
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
namespace GOAPI\IO\Resources; | ||
namespace GOAPI\IO\Resources\Stock; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
|
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,49 @@ | ||
<?php | ||
|
||
|
||
$client = new \GOAPI\IO\Client([ | ||
'api_key' => getenv('GOAPI_IO_API_KEY'), // your api key | ||
]); | ||
|
||
test('get client instance', function () use($client) { | ||
$region = $client->createIndonesianRegion(); | ||
|
||
expect($region instanceof \GOAPI\IO\IndonesianRegion)->toBeTrue(); | ||
}); | ||
|
||
test('get provinsi', function () use($client) { | ||
$region = $client->createIndonesianRegion(); | ||
|
||
$response = $region->getProvinsi(); | ||
|
||
expect($response->values())->toBeArray(); | ||
expect($response->values()[0] instanceof \GOAPI\IO\Resources\Region\Region)->toBeTrue(); | ||
}); | ||
|
||
test('get kota', function () use($client) { | ||
$region = $client->createIndonesianRegion(); | ||
|
||
$response = $region->getKota('11'); | ||
|
||
|
||
expect($response->values())->toBeArray(); | ||
expect($response->values()[0] instanceof \GOAPI\IO\Resources\Region\Region)->toBeTrue(); | ||
}); | ||
|
||
test('get kecamatan', function () use($client) { | ||
$region = $client->createIndonesianRegion(); | ||
|
||
$response = $region->getKecamatan('11.01'); | ||
|
||
expect($response->values())->toBeArray(); | ||
expect($response->values()[0] instanceof \GOAPI\IO\Resources\Region\Region)->toBeTrue(); | ||
}); | ||
|
||
test('get kelurahan', function () use($client) { | ||
$region = $client->createIndonesianRegion(); | ||
|
||
$response = $region->getKelurahan('11.01.01'); | ||
|
||
expect($response->values())->toBeArray(); | ||
expect($response->values()[0] instanceof \GOAPI\IO\Resources\Region\Region)->toBeTrue(); | ||
}); |
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