public function getKey() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiSshKeys()->getAuthenticatedUserKey(1); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function deleteEmail() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiEmails()->deleteAuthenticatedUserEmail('*****@*****.**'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function deleteBranch() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiBranches()->deleteBranch('domain', 'projectName', 'branchName', true); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function getTag() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiTags()->getTag('domain', 'projectName', 'tag name'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function getCompare() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiCommits()->getCompare('domain', 'projectName', 'base revision', 'head revision'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function getWorkspace() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiWorkspaces()->getWorkspace('domain'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function testGetWorkspace() { $buddy = new Buddy(['accessToken' => getenv('TOKEN_ALL')]); $arr = $buddy->getApiWorkspaces()->getWorkspaces()->getWorkspaces(); $this->assertGreaterThan(0, count($arr)); $resp = $buddy->getApiWorkspaces()->getWorkspace($arr[0]->getDomain()); $this->assertInstanceOf('Buddy\\Objects\\Workspace', $resp); $this->assertNotEmpty($resp->getCreateDate()); $this->assertNotEmpty($resp->getHtmlUrl()); $this->assertNotEmpty($resp->getUrl()); $this->assertNotEmpty($resp->getDomain()); $this->assertNotEmpty($resp->getId()); $this->assertNotEmpty($resp->getName()); $this->assertNotEmpty($resp->getOwnerId()); $this->assertInternalType('bool', $resp->getFrozen()); $this->assertInternalType('array', $resp->getJson()); }
public function editAuthenticatedUser() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $user = new User(); $user->setName('My new name'); $resp = $buddy->getApiProfile()->editAuthenticatedUser($user); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function deleteFile() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $content = new SourceContent(); $content->setMessage('delete test'); $content->setBranch('master'); $resp = $buddy->getApiSource()->deleteFile($content, 'domain', 'projectName', 'test.js'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function getMemberProjects() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiMembers()->getWorkspaceMemberProjects('domain', 1, ['status' => Project::STATUS_ACTIVE]); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
/** * @expectedException \Buddy\Exceptions\BuddyResponseException * @expectedExceptionMessage Invalid client_id */ public function testGetAccessTokenWithRedirectUrl() { $_GET = []; $_GET['state'] = 'state'; $_GET['code'] = 'code'; $app = new Buddy(['clientId' => 'clientId', 'clientSecret' => 'secret']); $app->getOAuth()->getAccessToken('state', 'http://12.0.0.1'); }
public function deleteScenarioAction() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiScenarios()->deleteScenarioAction('domain', 'projectName', 1, 1); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function deleteWebhook() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $resp = $buddy->getApiWebhooks()->deleteWebhook('domain', 1); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function testInstantiating() { $buddy = new Buddy(); $this->assertInstanceOf('Buddy\\BuddyOAuth', $buddy->getOAuth()); }
/** * @expectedException \Exception * @expectedExceptionMessage v2 is not an integer */ public function testSubWrongV2() { $buddy = new Buddy(); $buddy->sub(3, '2'); }