Support for new webhook endpoints (show)

This commit is contained in:
Sven Rymenants 2019-06-20 22:14:42 +02:00 committed by David Garcia
parent 1a5e3ceee8
commit 379cd2a36e
2 changed files with 38 additions and 2 deletions

View File

@ -33,8 +33,8 @@ final class ShowResponse implements ApiResponse
return $model;
}
public function getWebhookUrl(): ?string
public function getWebhookUrls(): ?array
{
return $this->webhook['url'] ?? null;
return $this->webhook['urls'] ?? null;
}
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
/*
* Copyright (C) 2013 Mailgun
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace Mailgun\Tests\Model\Webhook;
use Mailgun\Model\Webhook\ShowResponse;
use Mailgun\Tests\Model\BaseModelTest;
class ShowResponseTest extends BaseModelTest
{
public function testHook1()
{
$json =
<<<'JSON'
{
"webhook": {
"urls": [
"http:\/\/example.com\/hook_1"
]
}
}
JSON;
$model = ShowResponse::create(json_decode($json, true));
$this->assertContains('http://example.com/hook_1', $model->getWebhookUrls());
}
}