Skip to content

Commit

Permalink
Merge pull request #185 from donkidd/add_projects_to_groups
Browse files Browse the repository at this point in the history
Addition of Projects API calls in Group Model
  • Loading branch information
m4tthumphrey authored Jun 6, 2017
2 parents 9244192 + df94484 commit a572f6b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Gitlab/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,18 @@ public function removeMember($group_id, $user_id)
{
return $this->delete('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id));
}

/**
* @param $id
* @param int $page
* @param int $per_page
* @return mixed
*/
public function projects($id, $page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups/'.$this->encodePath($id).'/projects', array(
'page' => $page,
'per_page' => $per_page
));
}
}
11 changes: 11 additions & 0 deletions lib/Gitlab/Model/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@ public function removeMember($user_id)

return true;
}

/**
* @return Group
*/
public function projects()
{

$data = $this->api('groups')->projects($this->id);

return Group::fromArray($this->getClient(),$data);
}
}
2 changes: 2 additions & 0 deletions lib/Gitlab/Model/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ class Node extends AbstractModel
'type',
'mode',
'id',
'path',
'project'
);


/**
* @param Client $client
* @param Project $project
Expand Down
1 change: 1 addition & 0 deletions test/Gitlab/Tests/Api/ProjectsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function shouldGetOwnedProjects()
$this->assertEquals($expectedArray, $api->owned(3, 50));
}


/**
* @test
*/
Expand Down

0 comments on commit a572f6b

Please sign in to comment.