Skip to content

Commit

Permalink
add /v2/wvw/ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
darthmaim committed Jan 22, 2017
1 parent 6985912 commit 446749b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/V2/Endpoint/WvW/RankEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\WvW;

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 RankEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint {
use BulkEndpoint, LocalizedEndpoint;

/**
* {@inheritdoc}
*/
public function url() {
return 'v2/wvw/ranks';
}
}
4 changes: 4 additions & 0 deletions src/V2/Endpoint/WvW/WvWEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ public function matches() {
public function objectives() {
return new ObjectiveEndpoint( $this->api );
}

public function ranks() {
return new RankEndpoint( $this->api );
}
}
11 changes: 11 additions & 0 deletions tests/V2/WvWEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,15 @@ public function testMatchEndpoint() {
$this->mockResponse('{"id":"2-6","scores":{"red":169331,"blue":246780,"green":216241}}');
$this->assertEquals(169331, $endpoint->world('id')->scores->red);
}

public function testRankEndpoint() {
$endpoint = $this->api()->wvw()->ranks();

$this->assertEndpointUrl('v2/wvw/ranks', $endpoint);
$this->assertEndpointIsBulk($endpoint);
$this->assertEndpointIsLocalized($endpoint);

$this->mockResponse('{"id":1,"title":"Invader","min_rank":1}');
$this->assertEquals('Invader', $endpoint->get(1)->title);
}
}

0 comments on commit 446749b

Please sign in to comment.