-
Notifications
You must be signed in to change notification settings - Fork 9
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 #109 from GW2Treasures/endpoints/mailcarrier-pvp-h…
…eroes Add mailcarrier and pvp/heroes endpoints
- Loading branch information
Showing
11 changed files
with
214 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Account; | ||
|
||
use GW2Treasures\GW2Api\GW2Api; | ||
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class MailcarrierEndpoint extends Endpoint implements IAuthenticatedEndpoint { | ||
use AuthenticatedEndpoint; | ||
|
||
public function __construct( GW2Api $api, $apiKey ) { | ||
parent::__construct( $api ); | ||
|
||
$this->apiKey = $apiKey; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/account/mailcarriers'; | ||
} | ||
|
||
public function get() { | ||
return $this->request()->json(); | ||
} | ||
} |
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 GW2Treasures\GW2Api\V2\Endpoint\Account\Pvp; | ||
|
||
use GW2Treasures\GW2Api\GW2Api; | ||
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class HeroEndpoint extends Endpoint implements IAuthenticatedEndpoint { | ||
use AuthenticatedEndpoint; | ||
|
||
public function __construct( GW2Api $api, $apiKey ) { | ||
parent::__construct( $api ); | ||
|
||
$this->apiKey = $apiKey; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/account/pvp/heroes'; | ||
} | ||
|
||
public function get() { | ||
return $this->request()->json(); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Account\Pvp; | ||
|
||
use GW2Treasures\GW2Api\GW2Api; | ||
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class PvpEndpoint extends Endpoint implements IAuthenticatedEndpoint { | ||
use AuthenticatedEndpoint; | ||
|
||
public function __construct(GW2Api $api, $apiKey) { | ||
parent::__construct($api); | ||
|
||
$this->apiKey = $apiKey; | ||
} | ||
|
||
/** | ||
* The url of this endpoint. | ||
* | ||
* @return string | ||
*/ | ||
public function url() { | ||
return 'v2/account/pvp'; | ||
} | ||
|
||
public function heroes() { | ||
return new HeroEndpoint($this->api, $this->apiKey); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Mailcarrier; | ||
|
||
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint; | ||
|
||
class MailcarrierEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint { | ||
use BulkEndpoint, LocalizedEndpoint; | ||
|
||
/** | ||
* The url of this endpoint. | ||
* | ||
* @return string | ||
*/ | ||
public function url() { | ||
return 'v2/mailcarriers'; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Pvp; | ||
|
||
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint; | ||
|
||
class HeroEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint { | ||
use BulkEndpoint, LocalizedEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/pvp/heroes'; | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
class MailcarrierEndpointTest extends TestCase { | ||
public function test() { | ||
$endpoint = $this->api()->mailcarriers(); | ||
|
||
$this->assertEndpointIsBulk( $endpoint ); | ||
$this->assertEndpointIsLocalized( $endpoint ); | ||
$this->assertEndpointUrl( 'v2/mailcarriers', $endpoint ); | ||
|
||
$this->mockResponse('[1,2,3,4,5,6,8,12,13]'); | ||
$this->assertEquals( [1,2,3,4,5,6,8,12,13], $endpoint->ids() ); | ||
} | ||
} |
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