Skip to content

Commit

Permalink
api fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalkaoz committed Jul 21, 2016
1 parent 9820b7e commit 1b095d8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions spec/Api/ProjectsSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public function it_is_initializable()

public function it_calls_the_correct_url_on_all(Client $client)
{
$client->request('GET', 'projects', [])->willReturn([]);
$client->request('GET', 'projects', ['orga_name' => 'foo', 'team_name' => 'bar'])->willReturn([]);

$this->all()->shouldBeArray();
$this->all('foo', 'bar')->shouldBeArray();
}

public function it_calls_the_correct_url_on_show_and_has_a_Pager_injected(Client $client)
Expand Down
2 changes: 1 addition & 1 deletion spec/Output/ProjectsSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function it_prints_a_table_on_all()
$output = new BufferedOutput();
$this->all($output, [
[
'id' => '1337',
'ids' => '1337',
'name' => 'digitalkaoz/versioneye-php',
'project_type' => 'composer',
'public' => false,
Expand Down
7 changes: 5 additions & 2 deletions src/Api/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ class Projects extends BaseApi implements Api
/**
* shows user`s projects.
*
* @param string $orgaName
* @param string $teamName
*
* @return array
*/
public function all()
public function all($orgaName, $teamName = null)
{
return $this->request('projects');
return $this->request('projects', 'GET', ['orga_name' => $orgaName, 'team_name' => $teamName]);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/Output/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public function show(OutputInterface $output, array $response)
$response,
function ($heading, $value) {
if ('Source' === $heading) {
$value = array_filter($value, function ($link) {
return 'Source' === $link['name'];
});

if (!empty($value)) {
return array_pop($value)['link'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Output/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function all(OutputInterface $output, array $response)
{
$this->printTable($output,
['Key', 'Name', 'Type', 'Public', 'Dependencies', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
['id', 'name', 'project_type', 'public', 'dep_number', 'out_number', 'updated_at', 'licenses_red', 'licenses_unknown'],
['ids', 'name', 'project_type', 'public', 'dep_number', 'out_number', 'updated_at', 'licenses_red', 'licenses_unknown'],
$response,
function ($key, $value) use ($output) {
if ('public' === $key) {
Expand Down

0 comments on commit 1b095d8

Please sign in to comment.