Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue creating snippet #43

Closed
jloh opened this issue Jun 5, 2014 · 4 comments
Closed

Issue creating snippet #43

jloh opened this issue Jun 5, 2014 · 4 comments

Comments

@jloh
Copy link

jloh commented Jun 5, 2014

I can't work out what I'm doing wrong. I've got the following code:

<?php

require 'vendor/autoload.php';

$client = new \Gitlab\Client('https://gitlab.example.com/api/v3/'); // change here
$client->authenticate('not_actually_real', \Gitlab\Client::AUTH_URL_TOKEN); // change here

$project = new \Gitlab\Model\Project(17, $client);
$snippet = $project->createSnippet('title', 'someting.txt', 'code_is_cool');

?>

But I'm getting the following error:

Fatal error: Uncaught exception 'Gitlab\Exception\InvalidArgumentException' in /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php:115
Stack trace:
#0 /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/AbstractModel.php(31): Gitlab\Client->api('snippets')
#1 /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Project.php(464): Gitlab\Model\AbstractModel->api('snippets')
#2 /gitlab/test.php(24): Gitlab\Model\Project->createSnippet('title', 'someting.txt', 'code_is_cool')
#3 {main}
  thrown in /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php on line 115

What am I doing wrong?

@jubianchi
Copy link
Contributor

@jloh
Copy link
Author

jloh commented Jun 5, 2014

I'm sorry, I don't understand.

@jubianchi
Copy link
Contributor

@MooASh I'll try to push a fix today.

@m4tthumphrey
Copy link
Contributor

@MooASh for now until one of us has time to push a fix, just replace

case 'hooks':
case 'system_hooks':
    $api = new Api\SystemHooks($this);
break;

with

case 'hooks':
case 'system_hooks':
    $api = new Api\SystemHooks($this);
    break;

case 'snippets':
    $api = new Api\Snippets($this);
    break;

arturf pushed a commit to arturf/php-gitlab-api that referenced this issue Oct 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants