public function testAddWebhook2() { $webhook = new Webhook(); $webhook->setTargetUrl('http://onet.pl'); $webhook->setEvents([Webhook::EVENT_RELEASE_FAILED]); $resp = Utils::getBuddy()->getApiWebhooks()->addWebhook($webhook, Utils::getWorkspaceDomain()); $this->assertInstanceOf('Buddy\\Objects\\Webhook', $resp); $this->assertEquals($webhook->getTargetUrl(), $resp->getTargetUrl()); $this->assertEquals($webhook->getSecretKey(), $resp->getSecretKey()); $this->assertEquals($webhook->getProjectFilter(), $resp->getProjectFilter()); $events = $resp->getEvents(); $this->assertInternalType('array', $events); $this->assertEquals(1, count($events)); $this->assertEquals(Webhook::EVENT_RELEASE_FAILED, $events[0]); }
public function editWebhook() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $webhook = new Webhook(); $webhook->setEvents([Webhook::EVENT_PUSH, Webhook::EVENT_RELEASE_FAILED, Webhook::EVENT_RELEASE_SUCCESSFUL]); $resp = $buddy->getApiWebhooks()->editWebhook($webhook, 'domain', 1); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
/** * @return Webhook */ public static function addWebhook() { $webhook = new Webhook(); $webhook->setTargetUrl('http://onet.pl'); $webhook->setEvents([Webhook::EVENT_RELEASE_FAILED]); return Utils::getBuddy()->getApiWebhooks()->addWebhook($webhook, Utils::getWorkspaceDomain()); }